IF( NOT(ISNULL(Submission__c.DPM_Project__c)),
ahttps://url.aspx?PROJECTID={!Opportunity.Name}&LOCATIONID={!Opportunity.Location__c}&INNCODE={!Opportunity.Inn_Code__c}&BRANDCODE={!Opportunity.Brand_Items__c}, ahttps://url.aspx?PROJECTID={!Lead.Name}&LOCATIONID={!Lead.Location__c}&INNCODE={!Lead.Inn_Code__c}&BRANDCODE={!Lead.Future_Brand__c})
I've had this formula in my custom button. But when saving, it appears to have an error.
{!IF( NOT(ISNULL(Submission__c.DPM_Project__c)), "ahttps://url.aspx?PROJECTID={!Opportunity.Name}&LOCATIONID={!Opportunity.Location__c}&INNCODE={!Opportunity.Inn_Code__c}&BRANDCODE={!Opportunity.Brand_Items__c}", "ahttps://url.aspx?PROJECTID={!Lead.Name}&LOCATIONID={!Lead.Location__c}&INNCODE={!Lead.Inn_Code__c}&BRANDCODE={!Lead.Future_Brand__c}")}
But for this one it doesn't have an error but when clicking the custom button, the link has a salesforce link before the link in the formula. Is there something wrong in my condition on both scenario? Thanks in advance.
NOTE: Don't mind the letter a before the https because i need to have at least 10rep to post more than 2 links. Thanks again.
Best Answer
Merge fields start with
{!
and end with}
. You don't use them in the middle of a formula. To merge in the middle of the formula, you want to use the concatenation operator,&
. However, doing it the way you are doing it might break on some inputs.I'd avoid possible encoding errors by using URLFOR, instead. Symbols such as &, =, and %, can cause parameters to get screwed up/misinterpreted, etc.
(Note: I reversed the true/false values to avoid the unnecessary extra NOT function, but this is mostly just a matter of preference).