How to send the newly created salesforce id to a Custom APEX action as a parameter

edited April 2017 in Questions
I want to update the newly created salesforce id to a field in different model. Please find my below

var prevAppModel = skuid.model.getModel('PrevApplication');var prevAppRow = prevAppModel.getFirstRow();

result = sforce.apex.execute('CreateNewLoanApplication','createApplication', param);        
        var relMsg = result.toString().split('##');
       alert("### "+relMsg[0]+relMsg[1]);
       if (relMsg[0] === 'FAILED') {
       } else {
           alert("Application Created Successfully.");
           prevAppRow.Refinance_RB_Id__c = result;

I am able to alert the result with the newly created id but the model is never getting updated


  • edited April 2017
    Use the updateRow function and it should work.
  • edited April 2017
    Hi Pete,

    Thanks for your immediate response.Tried but did not  work can you please give me the exact syntax if possible.
  • edited April 2017
    var prevAppModel = skuid.model.getModel('PrevApplication'),      prevAppRow = prevAppModel.getFirstRow();  ....  ....  ....  ....  result = sforce.apex.execute('CreateNewLoanApplication','createApplication', param);            var relMsg = result.toString().split('##');  alert("### "+relMsg[0]+relMsg[1]);  if (relMsg[0] === 'FAILED') {      alert(relMsg[1]);  } else {      alert("Application Created Successfully.");      alert(result);      // updated syntax below      var changes = {          Refinance_RB_Id__c: result      };      prevAppModel.updateRow(prevAppRow, changes);  }
    I updated the syntax at the end. Let me know if you have any questions :)
  • edited April 2017
    Thanks Pete. I dont know for some reason the vale is never getting updated in the column . I have even run an save model after the snippet to make sure the data is saved.

    I have to send the newly created id to the custom apex action. I tried too many way and thought that I would update to a field and send the field value but No luck. Any insights would help me a lot. Thanks in Advance
  • edited April 2017
    It looks like you are trying to create a hierarchy of applications. If that's true, take care of this inside the apex class that you call out to and re-query the models. It seems like this should be a behavior of that method. If this is not true, please let me know what the goal is.
  • edited April 2017
    Okay Let me put it in another way. Im cloning an application manually by populating few fields. As I have to clone the related  child records.I cannot modify in CreateNewLoanApplication  as it is being called from various locations. I thought of calling an APEX action to which I have to pass both the previous application Id and newly created application Id.

    I have two models in my SKUID page one for previous application ,which is conditioned with id = prevapp id and new application model to create a new application.

Sign In or Register to comment.