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 = applicationModel.getFirstRow();<br>alert("applicationRow "+applicationRow);<br>var appId =applicationRow.Id ; <br>var agree = confirm("Are you sure ?");<br>alert("agree "+agree);<br>if (agree){<br> if(applicationRow.Genesis_Status__c == "NEW - PRICING GENERATED"){<br> var retVal = sforce.apex.execute("DemooOrgUtils","borrowerAccepted",{app:appId}); <br> window.location.reload();<br> }<br> else<br> alert("Please generate Pricing ");<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 ");
}
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.