Skip to main content

I am writing code for a javascript button.I have a custom object Application and there is a status field in Application .I want to check the value of this field that if(application.status==‘pricing generated’ then enter into the loop.I am not sure how to get a field of particular object in skuid.please help .Here is the code 

var applicationModel = skuid.model.getModel(‘Application’);alert("applicationModel "+applicationModel);
var applicationRow =  applicationModel.dataM0];
alert("applicationRow "+applicationRow);
var appId =applicationRow.Id ; 
var agree = confirm(“Are you sure ?”);
alert("agree "+agree);
if (agree){
    if( appId.genesis_Status_c==“NEW - PRICING GENERATED”){
    var retVal = sforce.apex.execute(“DemooOrgUtils”,“borrowerAccepted”,{app:appId}); 
    window.location.reload();
    }
    else
    alert("Please generate Pricing  ");
}

Your almost there… Just try this:


var applicationModel = skuid.model.getModel('Application');<br>alert("applicationModel "+applicationModel);<br>var applicationRow = &nbsp;applicationModel.getFirstRow();<br>alert("applicationRow "+applicationRow);<br>var appId =applicationRow.Id ;&nbsp;<br>var agree = confirm("Are you sure ?");<br>alert("agree "+agree);<br>if (agree){<br>&nbsp; &nbsp; if(applicationRow.Genesis_Status__c == "NEW - PRICING GENERATED"){<br>&nbsp; &nbsp; var retVal = sforce.apex.execute("DemooOrgUtils","borrowerAccepted",{app:appId});&nbsp;<br>&nbsp; &nbsp; window.location.reload();<br>&nbsp; &nbsp; }<br>&nbsp; &nbsp; else<br>&nbsp; &nbsp; alert("Please generate Pricing &nbsp;");<br>}




Thanks for the reply .
But I am still  having a problem here. If I use this ‘applicationRow.Genesis_Status__c’ and applicationRow.Lending_Product__c are returning Unidentified and always executing the else part.




var applicationModel = skuid.model.getModel(‘Application’);alert("applicationModel "+applicationModel);
var applicationRow =  applicationModel.datan0];
alert("applicationRow "+applicationRow);
var appId =applicationRow.Id;
alert("applicationRow.Id   "+ applicationRow.Id);
alert("Lending_Product__c "+ applicationRow.Lending_Product__c);
alert("status "+ applicationRow.genesis_Status_c); 
var agree = confirm(“Are you sure ?”);
alert("agree "+agree);
if (agree){
    if( applicationRow.Genesis_Status__c==“NEW - PRICING GENERATED”){
    var retVal = sforce.apex.execute(“DemooOrgUtils”,“borrowerAccepted”,{app:appId}); 
    window.location.reload();
    }
    else
    alert("Please generate Pricing  ");
}