SetAbortAction(true) shows Invalid Update

NehaKataria
Kilo Explorer

Hi All,

 

I have created a before delete BR that sets the active field of the record as false and then aborts the delete action.

Below is the script for the BR and the delete UI Action.

try {      

      current.active = false;

      current.update();

      gs.addInfoMessage('DLA Request Item record deleted successfully.');

      current.setAbortAction(true);

     

}

catch(error) {

      gs.log('Error: Change Request Soft Delete for CMDB   - ' + error);

}

 

 

Delete UI Action :-

current.deleteRecord();

 

 

On click of the Delete button it sets the active field as false but also shows a "Invalid update" error message.

Please help me find the root cause and resolution so that this "Invalid update" error message doesnot pop up on click of delete.

2 REPLIES 2

User140988
Kilo Guru


Hi Neha,



The setAbortAction(true); command will result in invalid update statement which is stopping the current operation.


User140988
Kilo Guru

You can try some tips mentioned here, but all in all, you cant avoid the message or need to have another one.


https://community.servicenow.com/message/684192#684192