You need to sign in to do that
Don't have an account?
Sonia Genesse
onClick Exectue Java script for SF button, need to add addtional IF
Hello,
I have created an onClick Exectue Java script button, which works well except that I need to add an addtional IF for the same picklist value:
if SVMXC__Service_Order__c.SVMXC__Order_Status__c, picklsit value = "Closed" or "Unresolved", how do I add this to my existing script below?
if({!NOT(ISPICKVAL(SVMXC__Service_Order__c.SVMXC__Order_Status__c, "Closed"))}){
alert("Close Work Order button has not been completed, the Work Order Order Status has not been set to Closed or Unresolved");
}
else{
window.top.location.href =
"/apex/loop__looplus?sessionId={!$Api.Session_ID}&eid={!SVMXC__Service_Order__c.Id}&filter={!SVMXC__Service_Order__c.Email_Integrator__c}Service&servcont_Name={!SVMXC__Service_Order__c.SVMXC__Contact__c}&servcont_email={!SVMXC__Service_Order__c.Contact_Email__c}";
}
Thanks!
Sonia
I have created an onClick Exectue Java script button, which works well except that I need to add an addtional IF for the same picklist value:
if SVMXC__Service_Order__c.SVMXC__Order_Status__c, picklsit value = "Closed" or "Unresolved", how do I add this to my existing script below?
if({!NOT(ISPICKVAL(SVMXC__Service_Order__c.SVMXC__Order_Status__c, "Closed"))}){
alert("Close Work Order button has not been completed, the Work Order Order Status has not been set to Closed or Unresolved");
}
else{
window.top.location.href =
"/apex/loop__looplus?sessionId={!$Api.Session_ID}&eid={!SVMXC__Service_Order__c.Id}&filter={!SVMXC__Service_Order__c.Email_Integrator__c}Service&servcont_Name={!SVMXC__Service_Order__c.SVMXC__Contact__c}&servcont_email={!SVMXC__Service_Order__c.Contact_Email__c}";
}
Thanks!
Sonia
|| {!NOT(ISPICKVAL(SVMXC__Service_Order__c.SVMXC__Order_Status__c, "Unresolved"))}){
alert("Close Work Order button has not been completed, the Work Order Order Status has not been set to Closed or Unresolved");
}
Sonia , Above code will work fine . Hope this helps !!!
I've tried both of these solutions and both are throwing the Alert message no matter what the the value of this field is: {!SVMXC__Service_Order__c.SVMXC__Order_Status__c}.
This Javascript works fine on it's own as shown below, but when I try to include the not equal to "Unresolved" status, I'm receiving an error even for "Closed" and "Unresolved"..... any thoughts as to why?
if({!NOT(ISPICKVAL(SVMXC__Service_Order__c.SVMXC__Order_Status__c, "Closed"))} || {!NOT(ISPICKVAL(SVMXC__Service_Order__c.SVMXC__Order_Status__c, "Unresolved"))}){
alert("Close Work Order button has not been completed, the Work Order Order Status has not been set to Closed or Unresolved");
}
}
else{
"window.top.location.href = '/apex/loop__looplus?sessionId={!$Api.Session_ID}&eid={!SVMXC__Service_Order__c.Id}&filter={!SVMXC__Service_Order__c.Email_Integrator__c}Service&servcont_Name={!SVMXC__Service_Order__c.SVMXC__Contact__c}&servcont_email={!SVMXC__Service_Order__c.Contact_Email__c}";
}
Thanks again!
Sonia