You need to sign in to do that
Don't have an account?
Kim Adil
Javascript button to validate that multi-picklist field is populated when lookup field is populated
I have a requirement to remove the validation rule and include the logic in the Javascript button. Here is the details
I have a field called 'account__c' (lookup field to account)
I have 3 multi-picklist fields, called:
multi-picklist A: values are: A1-A2-A3-A4
multi-picklist B: values are: B1-B-B3-B4
multi-picklist C: values are: C1-C2-C3-C4
if account selected is A, then ONLY 'multi-picklist A' field can be populated, the other two should NOT be populated. Same applies if account name is B or C.
I was actually using validation rule, and now I am asked to use Javascript button. We already have one in place that checks certain fields are not blank; it displays an alert if one field is blank.
I am asked to use the same logic I have in the validation rule, and add it to the button. I explained what needs to happen in my question above. Here is the code sample I have now:
I appreciate the help out there. Thank you
I have a field called 'account__c' (lookup field to account)
I have 3 multi-picklist fields, called:
multi-picklist A: values are: A1-A2-A3-A4
multi-picklist B: values are: B1-B-B3-B4
multi-picklist C: values are: C1-C2-C3-C4
if account selected is A, then ONLY 'multi-picklist A' field can be populated, the other two should NOT be populated. Same applies if account name is B or C.
I was actually using validation rule, and now I am asked to use Javascript button. We already have one in place that checks certain fields are not blank; it displays an alert if one field is blank.
I am asked to use the same logic I have in the validation rule, and add it to the button. I explained what needs to happen in my question above. Here is the code sample I have now:
{!REQUIRESCRIPT("/soap/ajax/25.0/connection.js")} {!REQUIRESCRIPT("/soap/ajax/25.0/apex.js")} var invoiceID = '{!invoice__c.Id}'; //Get the inovice id var agree = confirm("Are you sure you want to submit for approval?"); if(agree) { if ({!ISNULL(invoice__c.Field1__c)} || {!ISNULL(invoice__c.Field2__c)} || {!ISNULL(invoice__c.Field3__c)} || {!ISNULL(TEXT(invoice__c.Field4__c))}) { alert('Check Required Fields are populated ' ); } else { var result = sforce.apex.execute("ApexClassName","MethodName",{ InvoiceID : invoiceID }); document.location.reload(true); } }
I appreciate the help out there. Thank you
Please check with this.
Regards,
Nagendra.P