You need to sign in to do that
Don't have an account?
Shamus Kelley 4
Control/lock Custom OnClick Button while record is within approval process
How can I modify this code to prohibit custom button from functioning while record is within the approval process? See image for code detail. Also fire alert "Cannot use button while record is within the approval process"
thank you-
thank you-
Unless I'm mistaken it looks like you're already doing something similar? You already have a string check and an alert that pops up if Approvals are required. Is this not your goal? If they match the string check you doIt() but if it doesn't match the string check you generate an alert upon pressing the button.
If you're looking for a separate check, then I would think your best option is a checkbox (Boolean) that gets automatically set to True via workflow/lightning process builder after all necessary approvals are complete.
Then add to your // check opp section:
Boolean approval = "{!Opportunity.Checkbox_Field_Here__c}";
if (approval == true) {
doIt();
}
else{
alert("Cannot use button while record is within the approval process")
}