Issues with gr.isActionAborted()

kyrresc
Tera Expert

Hello,

I am having issues with gr.isActionAborted(). Even though my update does NOT go through, gr.isActionAborted() returns false. Weirdly, when logging gr.update(), it returns null... I logged it like this. This code snippet is placed within an if-statement checking that grTask.isValidRecord()

grTask.update();
gs.info("grTask: " + grTask.update());
gs.info("is action aborted?" + grTask.isActionAborted());
1 ACCEPTED SOLUTION

Hi,

see image below

1) I have 1 Before BR which blocks the update

So isActionAborted() -> gave true

find_real_file.png

find_real_file.png

I deactivated the BR and

So isActionAborted() -> gave false

find_real_file.png

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

14 REPLIES 14

Hi,

see image below

1) I have 1 Before BR which blocks the update

So isActionAborted() -> gave true

find_real_file.png

find_real_file.png

I deactivated the BR and

So isActionAborted() -> gave false

find_real_file.png

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

My record does not get updated however, even though gr.isActionAborted() returns false. As I mentioned gr.update() returns null, which is contradictive of gr.isActionAborted() returning false?

Hi,

Did you check why record is not getting updated?

try to add try catch block to know any exception thrown

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Yeah, 

it's due to a Data Policy that I created. I do not want my record to get updated for that scenario. My issue lies in gr.isActionAborted() returning false, even though record is NOT updated...

Hi,

Possibly isActionAborted() this works well with any before BR which blocks the update.

but doesn't work well with data policy.

As per docs it says this methods is mainly for before business rules

Abort a database action in a before business-rule

find_real_file.png

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader