I know next to nothing about javascript so don't beat me up too much if this is utter garbage, but here is my attempt at a somewhat simple button that looks at 2 values and kicks a flow off or surfaces an error message depending on the values:
{!REQUIRESCRIPT("/soap/ajax/34.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/34.0/apex.js")}
if(({!Account.OwnerId} == '00530000006Vg2N')) ||
({!Account.Inactive_Owner__c}));{
location.replace('/flow/Inside_Account_Update_Me');
}
else {alert("This Account is either not owned by Debbie or your role doesn't
allow you to move these accounts. Reach out to Sales Ops if you feel this is
in error");
}
The intention is for a user to click this button to assign the account to themselves. The code should look to see if it's owned by user a ('00530000006Vg2N') or if the user is inactive (checkbox where true = inactive). If either of those are true it should run the flow, if both are false it should surface the error message.
Any clues would be much appreciated.
Thanks, Mark