How to override abort action error message

Aishwaryayadav6
Tera Contributor

Trying to abort insert action if a record already exists with the same condition with a before insert BR.
The action is getting aborted but the system is not showing the error message which I added in the script, instead it shows system generated error message. 
How can I override that error message.

 

   // Add your code here
    var getHRCase = new GlideRecord('sn_hr_core_case_workforce_admin');
    getHRCase.addEncodedQuery('active=true^hr_service=a677b1eb47ad0dd41a1136dbd36d433b^subject_person=' + current.subject_person);
    getHRCase.query();
    if (getHRCase.next()) {
        gs.addErrorMessage("Error: Resignation request already exist, new request cannot be raised");	
        current.setAbortAction(true);
 }

 

 

 

0 REPLIES 0