You need to sign in to do that
Don't have an account?
toby curtis 6
How to add error message in apex trigger ?
Test__c trigObj = trigger..get(Test.id);
if(trigObj = null){
trigObj.addError('Cloned record should not have the same period as that of Parent record');
}
I am using this code not getting the output as excepted.
if(trigObj = null){
trigObj.addError('Cloned record should not have the same period as that of Parent record');
}
I am using this code not getting the output as excepted.
if(trigObj = null)
To:
if(trigObj == null)
All Answers
if(trigObj != null){
trigObj.addError('Cloned record should not have the same period as that of Parent record');
}
Try this.
You can add error messages in triggers by using Salesforce trigger addError method.
For Example - Sobject.addError('Error Messages');
Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.
Thanks.
if(trigObj = null)
To:
if(trigObj == null)