You need to sign in to do that
Don't have an account?

If statement in Custom button URL with Error Message for false condition
I have added a custom button to Quote object including an IF conditional statement , when the statement is true it functions correctly however if false instead of showing error message statement I get URL No Longer Exists error - please see code below. What can I do to fix this?
{!IF( ISPICKVAL( Quote.Status , 'Approved') , URLFOR('/apex/dsfs__DocuSign_CreateEnvelope', null, [SourceID = Quote.Id, LF='1', CRL='Email~'+Quote.Email+';LastName~'+Quote.Full_Name__c+';Role~Signer 1,LoadDefaultContacts~0', OCO='Send' ]), "Quote must be submitted for approval") }
Regards, Roger
{!IF( ISPICKVAL( Quote.Status , 'Approved') ,
URLFOR('/apex/dsfs__DocuSign_CreateEnvelope', null, [SourceID = Quote.Id,
LF='1',
CRL='Email~'+Quote.Email+';LastName~'+Quote.Full_Name__c+';Role~Signer 1,LoadDefaultContacts~0']), URLFOR('/apex/DocuSignQuoteNotApproved'))}
All Answers
Try to create varible and store the values there and call the variables based on your if logic.
var res = URLFOR('/apex/dsfs__DocuSign_CreateEnvelope', null, [SourceID = Quote.Id, LF='1', CRL='Email~'+Quote.Email+';LastName~'+Quote.Full_Name__c+';Role~Signer 1,LoadDefaultContacts~0', OCO='Send' ]);
var errMsg = "Quote must be submitted for approval";
{!IF( ISPICKVAL( Quote.Status , 'Approved') ,res , errMsg) }
Thanks,
SEKAR RAJ
Regards, Roger
{!IF( ISPICKVAL( Quote.Status , 'Approved') ,
URLFOR('/apex/dsfs__DocuSign_CreateEnvelope', null, [SourceID = Quote.Id,
LF='1',
CRL='Email~'+Quote.Email+';LastName~'+Quote.Full_Name__c+';Role~Signer 1,LoadDefaultContacts~0']), URLFOR('/apex/DocuSignQuoteNotApproved'))}