1
  {!IF( {!AND(Legal_Contract__c.Parent_Company_LC__c = "Company A",  Legal_Contract__c.Approval_Status_LC__c = "Approved")}, URLFOR("/apex/dsfs__DocuSign_CreateEnvelope",null, [sId=Legal_Contract__c.Id,ecId="a1Kn0000000AMMAEA4"]), 
        {!IF( {!AND(Legal_Contract__c.Parent_Company_LC__c = "Company B",  Legal_Contract__c.Approval_Status_LC__c = "Approved")}, URLFOR("/apex/dsfs__DocuSign_CreateEnvelope",null, [sId=Legal_Contract__c.Id,ecId="a1Kn0000000AMM9EAO"]),
        null
        )})}

2 Questions:

  1. Getting a syntax error, but not sure why.
  2. How do I stop this button from working if it doesn't meet the condition? I put the null in there, but now sure if that will do the trick. It would be nice to have a popup or alert message explaining why, but don't think that is possible in lightning.

Updated code, which addresses question 1. Question 2 still an issue:

{!IF( 
AND(Legal_Contract__c.Parent_Company_LC__c = "Company A", ISPICKVAL(Legal_Contract__c.Approval_Status_LC__c, "Approved")), 
URLFOR ("/apex/dsfs__DocuSign_CreateEnvelope",null, [sId=Legal_Contract__c.Id,ecId="a1Kn0000000AMMAEA4"]), 

IF( 
AND(Legal_Contract__c.Parent_Company_LC__c = "Company B", ISPICKVAL(Legal_Contract__c.Approval_Status_LC__c, "Approved")), 
URLFOR("/apex/dsfs__DocuSign_CreateEnvelope",null, [sId=Legal_Contract__c.Id,ecId="a1Kn0000000AMM9EAO"]), 

null)) 
}

1 Answer 1

0

The main issue is that you have multiple binding tags {!...} in the statement.

I have removed them here:

{!IF( AND(Legal_Contract__c.Parent_Company_LC__c = "Company A",  Legal_Contract__c.Approval_Status_LC__c = "Approved"), URLFOR ("/apex/dsfs__DocuSign_CreateEnvelope",null, [sId=Legal_Contract__c.Id,ecId="a1Kn0000000AMMAEA4"]), 
    IF(AND(Legal_Contract__c.Parent_Company_LC__c = "Company B",  Legal_Contract__c.Approval_Status_LC__c = "Approved")}, URLFOR("/apex/dsfs__DocuSign_CreateEnvelope",null, [sId=Legal_Contract__c.Id,ecId="a1Kn0000000AMM9EAO"]),null)
  )
}

Also, question 2... as you can't disable a button like this, make it reload this page. So instead of null, put in the current record id eg /abcn0000000YEHAAA

5
  • Oh!!! This is a regular button that you place on a Lightning layout. I thought you were making a component and I was pretty confused. Commented Feb 28, 2019 at 20:27
  • 1
    I would say... as you can't disable a button like this, make it reload this page. So instead of null, put in the current record id eg '/abcn0000000YEHAAA' Commented Feb 28, 2019 at 20:29
  • Edited answer to reflect new understanding. Commented Feb 28, 2019 at 20:33
  • Another solution is to use global action. I did this and it basically disabled the button.
    – user56320
    Commented Feb 28, 2019 at 21:13
  • Excellent! Of course, you can't use a global action in every situation. Commented Feb 28, 2019 at 22:09

You must log in to answer this question.