You need to sign in to do that
Don't have an account?
Minky Hyun
OnClick Javascript - if statement isn't working
I have the following OnClick Javascript code on custom Convert button on a lead page, and I have 2 "if" statements, but only the 2nd one is firing even though both if statement conditinos are met. Here's the code:
**********
if('{!Lead.Established_Need__c}'=='false')
{
alert('You must establish need before converting the lead');
}
if('{!Lead.Status}'!='Qualified')
{
alert('Status should be Qualified to convert the Lead');
}
else
{
window.location.href='/lead/leadconvert.jsp?retURL={!Lead.Id}&id={!Lead.Id}'
}
******
Can anyone tell me why?
**********
if('{!Lead.Established_Need__c}'=='false')
{
alert('You must establish need before converting the lead');
}
if('{!Lead.Status}'!='Qualified')
{
alert('Status should be Qualified to convert the Lead');
}
else
{
window.location.href='/lead/leadconvert.jsp?retURL={!Lead.Id}&id={!Lead.Id}'
}
******
Can anyone tell me why?
if ( {!Lead.Established_Need__c} ) {
alert('You must establish need before converting the lead');
}
Regards
console.log('{!Lead.Established_Need__c}');
if ( {!Lead.Established_Need__c} ) {
alert('You must establish need before converting the lead');
}
What do you see in the popup?