1

I have a custom button that has a javascript picklist that checks feild criteria. I need to add a multi-picklist field to the if statement to check if it does NOT contain "India".

here is the if statement part:

    if('{!Account.Original_Contract_Start__c}' == '' || '{!Account.Current_Contract_Start__c}' == '' || '{!Account.Contract_End__c}' == '' || '{!Account.Status__c}' != 'Active'  || {!CONTAINS(!Account.Target_Market__c, "India") == False } )
{

and here's the full syntax if needed:

{!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/20.0/apex.js")}
if('{!Account.Original_Contract_Start__c}' == '' || '{!Account.Current_Contract_Start__c}' == '' || '{!Account.Contract_End__c}' == '' || '{!Account.Status__c}' != 'Active'  || {!CONTAINS(!Account.Target_Market__c, "India") == False } )
{
window.alert("Hello {!$User.FirstName} Please make sure you have entered the values in Contract End, Original Contract Start and Current Contract Start fields and that the Account Status is Active");
}
else if('{!Account.Status__c}' == 'Active' && '{!Account.Approval_Progress__c}' == 'Closed Won')
{
window.open("/apex/echosign_dev1__AgreementTemplateProcess?masterid={!Account.Id}&templateId=a08o000000C6jYl ","_blank");
}
else if('{!Account.Status__c}' == 'Active' && '{!Account.Approval_Progress__c}' == 'Approved')
{
window.open("/apex/echosign_dev1__AgreementTemplateProcess?masterid={!Account.Id}&templateId=a08o0000004m8XH ","_blank");
}
1
  • 1
    Error: Field Account.Target_Market__c is a multi-select picklist field. Multi-select picklist fields are only supported in certain functions Apr 29, 2016 at 19:34

1 Answer 1

1

The function you are looking for is INCLUDES(). Change your CONTAINS call to {!INCLUDES(!Account.Target_Market__c, "India") == false}. You can also just use NOT() or ! instead of ==false - comparing against boolean literals is generally considered bad form. Your statement would then look like {!NOT(INCLUDES(!Account.Target_Market__c, "India"))} or {!!INCLUDES(!Account.Target_Market__c, "India")}

3
  • Thank you for the info. I actual tried both with still the same error result. any additional suggestions would be appreciated May 3, 2016 at 13:46
  • thank you '{NOT(!INCLUDES(Account.Target_Market__c, "India"))}' works May 3, 2016 at 15:22
  • I did a rookie move. I tested that when the conditions are not met but didn't test if it works when conditions are met, which is giving me the same result :(. but I'm closer than I was yesterday. So my popup msg comes up whether it's met or not. May 3, 2016 at 16:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .