Every time the if block of code is getting executed even if the condition is false .
I think the problem lies in null checker line
Here is the code-
var applicationModel = skuid.model.getModel(‘Application’);//alert("applicationModel "+applicationModel);
var applicationRow = applicationModel.datae0];
//alert("applicationRow "+applicationRow);
var appId =applicationRow.Id;
//alert("applicationRow.Id "+ applicationRow.Id);
var stat=applicationRow.genesis__Status__c;
//alert("stat " +stat);
var ad=applicationRow.genesis__Auto_Decisioning__c;
alert("autodecisioning " +ad);
var lending_product=applicationRow.genesis__Lending_Product__c;
alert("lending_product " +lending_product);
var newstat=“NEW - PRICING GENERATED”;
//alert("newstat " +newstat);
var newstat2=“APPROVED - CONVERTED TO CONTRACT”;
var agree = confirm(“Are you sure ?”);
if (agree){
if (stat.toUpperCase() == newstat2)
{
alert("Application is alerady Converted “);
}
else if (stat.toUpperCase() == newstat)
{
if((ad === true) )
{
if(lending_product !==‘null’ ) // this condition is failing.
{ var retVal = sforce.apex.execute(“DemooOrgUtils”,“borrowerAccepted”,{app:appId});
alert(‘retVal’+retVal);
window.location.reload();
}
else{
alert(”–Please insert a lending product-- “);
}
}
else{
alert(”–Please enable Auto Decisioning-- “);
}
}
else
alert(”----Please generate pricing---- ");
}
In alert lending_product shows ‘undefined’ but it contains null .So i am not sure what needs to be checked there .So I am now stuck here.
Page 1 / 1
I assume that genesis__Lending_Product__c is part of your model – correct?
Have you tried changing the code to
if (lending_product ) { ... }<br>else { alert("--Please insert a lending product-- "); }
- or -
if (lending_product !== undefined && lending_product !== null) {<br> // lending_product has a value<br>} else {<br> alert("--Please insert a lending product-- "); <br>}
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.