In the javascript button below (Salesforce classic) I would like to allow users to proceed only if a selected status is active. Also for a specific user profile, I would like to not allow to proceed if the record is too old:
{!REQUIRESCRIPT("/soap/ajax/33.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/33.0/apex.js")}
if ({!IF(ISPICKVAL(SBQQ__Quote__c.SBQQ__Status__c, "Status1") ||
ISPICKVAL(SBQQ__Quote__c.SBQQ__Status__c, "Status2") ||
ISPICKVAL(SBQQ__Quote__c.SBQQ__Status__c, "Status3") ||
ISPICKVAL(SBQQ__Quote__c.SBQQ__Status__c, "Status4"), false, true)})
{
alert("Proceed only if status 1, 2, 3 or 4");
}
else if ({!IF(DATEVALUE(SBQQ__Quote__c.CreatedDate) > DATEVALUE("2019-10-15") && "$User.ProfileId" = "00e200000000000", false, true)})
{
alert("Cannot proceed if date is earlier than 2019-10-15");
} else {
window.location = "/500";
}
Would be great if I can have some assistance on this. Thanks!