function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sonia GenesseSonia Genesse 

If condition with a custom button link

I have a custom button on a Custom Object.

Currently it's set as:

Behavior = Display in existing window with sidebar and Content Source = URL

I would like to add an alert if one field (!SVMXC__Service_Order__c.QA_Approved_By__c) on the Work Order object is NULL.

Currently I have the following, and it's comming back as "URL no longer Exists"

if('{!SVMXC__Service_Order__c.QA_Approved_By__c}' = NULL )
{
window.alert("QA Approved By is NULL, cannot Print IEF form");
}
else
{
window.open("/apex/loop__looplus?sessionId={!$Api.Session_ID}&eid={!SVMXC__Service_Order__c.Id}&redirectURL = "&ddpIds=a1y31000001Qqvi");
}


Thanks,
Sonia

 
Best Answer chosen by Sonia Genesse
Sonia GenesseSonia Genesse
Resolved this:

if({!ISBLANK(SVMXC__Service_Order__c.QA_Approved_By__c)}){ alert("QA Approved By is NULL, cannot Print IEF form"); } else{ window.top.location.href = "/apex/loop__looplus?sessionId={!$Api.Session_ID}" + "&eid={!SVMXC__Service_Order__c.Id}" + "&redirectURL=" + "&ddpIds=a1y31000001Qqvi"; }

With Content Source = "Onclick Javascript"