How to copy the data from one field to another field ?

edited July 25, 2018 in Questions
In Account i have Billing address and Shipping address.if the shipping address is null by pressing a button need to copy the billing address into the shipping address.

Comments

  • edited December 18, 2014
    Try using a custom javascript snippet with something like this...

    var params = arguments[0],   $ = skuid.$;
    var model = skuid.$M('YOURMODELNAME');
    var row = model.getFirstRow();
    // get your billing values and populate your shipping values
    var billingValue = model.getFieldValue(row,'YOURBILLINGFIELD');
    model.updateRow(row,'YOURSHIPPINGFIELD',billingValue);
    //etc... do the above steps of getting and updating for every field...
    model.save();
    model.updateData();

  • Rob HatchRob Hatch 🛠️ 
    edited September 1, 2016
    Guys - if you can wait a few days, I think you are going to be blown away!  The summer release is going to include the ability to declaratively set up multi-step actions like this.   A button click can be bound to the update of multiple fields, and then a model save and redisplay of the page component.  You really want to sign up for the Summer Release introduction webinar on Aug 21.  

    Look here:   http://go.skuidify.com/webmail/36142/56341955/0729072a03a5fe835266b82dbdeb2911

  • edited December 18, 2014
    I'm already signed up, can't wait!
  • edited October 19, 2014
    I hope,This one is  helpfull to you

     var $ = skuid.$;   
    var model = skuid.model.getModel('Account'); 
     
      
    // Function that will update the value of our Build Project row's Address fields 
    var updateStreetAddressField = function(){ 
      
        // Find the selected AccountId in the Build Project Model 
        var row = model.getFirstRow(); 
        var newStreet = model.getFieldValue(row,'BillingStreet',true); 
        var newCity = model.getFieldValue(row,'BillingCity',true); 
        var newState = model.getFieldValue(row,'BillingState',true); 
        var newCountry = model.getFieldValue(row,'BillingCountry',true); 
        var newBillingPostalCode = model.getFieldValue(row,'BillingPostalCode',true); 
       // var newBillingPostalCode = model.getFieldValue(row,'Account__r.BillingPostalCode',true); 
      
      
        // Force updates of the Build Project Street Address field 
        //with the AccountData BillingStreet 
        var updates = { 
            'ShippingStreet':newStreet, 
            'ShippingCity':newCity, 
            'ShippingState':newState, 
            'ShippingCountry':newCountry, 
            'ShippingPostalCode':newBillingPostalCode, 
            //'Build_City_Zip_Postal_Code__c':newBillingPostalCode               
        }; 
        model.updateRow(row,updates); 
     
     
    }; 
     
    updateStreetAddressField();


    Regards,
    RaghavendraReddy.

  • Rob HatchRob Hatch 🛠️ 
    edited September 1, 2016
    Raghav - that snippet will work,  but I'd look at the action framework released in Summer14.  You can do this with no code. 
  • edited January 8, 2016
    Rob, i have done above scenario using action frames work. I am facing a problem, like if the billing address field(any field like city or state etc,) is null, am getting value as 'false' in to shipping address fields. How i can add condition that can skip if the fields is null? 
  • edited January 8, 2016
    Rob, i have done above scenario using action frames work. I am facing a problem, like if the billing address field(any field like city or state etc,) is null, am getting value as 'false' in to shipping address fields. How i can add condition that can skip if the fields is null? 
  • Rob HatchRob Hatch 🛠️ 
    edited September 1, 2016
    Reddy,  this is pretty strange.  In all my testing, when fields are blank in the originating field  they are blank in the destination field.  Can you post a snapshot of your action framework properties for moving the fields from billing to shipping.  Below is what mine looks like:
     image



  • edited October 19, 2014
    Great Work Ragava..!! 
  • Matt SonesMatt Sones 💎💎💎
    edited February 10, 2017
    Rob, et al.,

    Is there a way to use the action framework to 'update a field on row(s)' with something like a Date field? The action framework gives me a calendar select tool when I choose 'specific date.' I enter wnat to be able to enter something like something like {{Date__c}}. Is that possible?
  • Rob HatchRob Hatch 🛠️ 
    edited February 10, 2017
    You can absolutely pass the existing value from one date field to another date field using the action framework.  If the field "Date__c" is in the model that provides context (to a page title or table) you can use the syntax you describe above {{Date__c}} to send the value for the row in context to the new field.  If you field is in another model you can use the global merge syntax... {{$Model.ModelName.data.0.Date__c}}  (changing the ModelName obviously...)


  • Matt SonesMatt Sones 💎💎💎
    edited December 7, 2016
    Rob,

    This is what I'm looking at:
    image
    The doesn't seem to be a way for me to enter {{Date__c}} in the Value field. The only characters I can type in the field are numbers and backslashes.

    Where have I gone wrong?
  • Rob HatchRob Hatch 🛠️ 
    edited September 1, 2016
    Well Double Dang.  In the builder it is not possible to pass merge data into an action that relates to a date field.  However if you go to the XML for the page you can put in the merge field.   

    I made an action where a new row was created on the task object and the opportunity close date was added as the due date.  Here is the XML for that action: 
    <action type="createRow" model="OpenTasks" appendorprepend="prepend" defaultmodefornewitems="edit">     <defaults>
          <default type="fieldvalue" field="ActivityDate" enclosevalueinquotes="true" value="{{CloseDate}}"/>
     
    I had to add the text:  value="{{CloseDate}}"  in the xml. 

    We will add a request to have date time fields changed in actions so merge data can be applied. 

  • Matt SonesMatt Sones 💎💎💎
    edited February 10, 2017
    Thanks, Rob. I didn't think of editing the xml directly.

    FYI, a similar situation with checkbox fields:
    image
  • Rob HatchRob Hatch 🛠️ 
    edited September 1, 2016
    Duly noted. 
  • edited December 18, 2017
    @Rob. how to check in branch whether the field referring in branch is not empty?
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!