You need to sign in to do that
Don't have an account?
Kyle Floersch 1
Custom Button Validation Rule
I have a custom button that I would like to validate against the Status field.
If Status does not equal "Approved by Business Manager" return an error message.
I have tried the following but does not work:
IF({!ISPICKVAL( Invoice__c.Status__c , "Approved by Business Manager")},
/apex/loop__looplus?sessionId={!$Api.Session_ID}&eid={!Invoice__c.Id}
&ddpids=a0Z50000009UjxA&deploy=a0Y500000091MwT
&contactid=0035000002ZrYHU,
Alert('Value can only be Approved by Business Manager'))
If Status does not equal "Approved by Business Manager" return an error message.
I have tried the following but does not work:
IF({!ISPICKVAL( Invoice__c.Status__c , "Approved by Business Manager")},
/apex/loop__looplus?sessionId={!$Api.Session_ID}&eid={!Invoice__c.Id}
&ddpids=a0Z50000009UjxA&deploy=a0Y500000091MwT
&contactid=0035000002ZrYHU,
Alert('Value can only be Approved by Business Manager'))
All Answers
I have it setup to execute JavaScript but seems to have an issue with the below underlined part of the code:
if(!{!ISPICKVAL(Account.CustomerPriority__c, "High")}){
alert('Value can only be Approved by Business Manager');
}else{
window.open("/apex/loop__looplus?sessionId"+{!$Api.Session_ID}+"&eid="+{!Invoice__c.Id}+"&ddpids=a0Z50000009UjxA&deploy=a0Y500000091MwT
&contactid=0035000002ZrYHU", "_blank");
}
Getting the following error:
A problem witht he OnClick javaScript for this button or link was encountered.
Unexpected token ILLEGAL
To test I ran this piece and it worked and triggered the alert and if correct status it opened the VF Page. But I need to add the IDs.
if(!{!ISPICKVAL(Invoice__c.Status__c, "Approved by Business Manager")}){
alert('Status is not Approved by Business Manager');
}else{
//alert("in else block");
window.open("/apex/loop__looplus", "_blank");
}
window.open("/apex/loop__looplus?sessionId=" + {!$Api.Session_ID} + "&eid= " +{!Invoice__c.Id} + "&ddpids=a0Z50000009UjxA&deploy=a0Y500000091MwT
&contactid=0035000002ZrYHU", "_blank");