Why do I get null in async on insert and delete business rule?

John_123_Snow
Mega Expert

find_real_file.png

(function executeRule(current, previous) {

gs.log(current.operation());

})(current, previous);

any reason why do I get null for current.operation() ? what I see online it should work but it doesnt.

 

1 ACCEPTED SOLUTION

Allen Andreas
Administrator
Administrator

Hi,

When trying to test this for myself, I saw this pop up below my code:

find_real_file.png

So, per that, async delete rules won't have access to current...because the record is deleted and gone, thus it can't know the operation.

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

View solution in original post

8 REPLIES 8

asifnoor
Kilo Patron

Hi,

The operation is not available during async because when async selected, it runs in parallel and not after or before the current operation. 

 

Allen Andreas
Administrator
Administrator

Hi,

When trying to test this for myself, I saw this pop up below my code:

find_real_file.png

So, per that, async delete rules won't have access to current...because the record is deleted and gone, thus it can't know the operation.

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

So how can I send/delete attachment via REST call business rule when the sys_attachment is updated or deleted? I need the current.table_sysid

Hi,

Sorry, I don't know fully what you're doing as this wasn't detailed in your original question...but if you're trying to send a rest call somewhere to tell it to delete and you can't capture current in async delete...then you'll need to do after.

Otherwise, other forms of async (not delete) seem to work fine.

So you'd want to break this out to it's own business rule, after delete BR for one action. Then async insert or update or whatever for the other scenario.

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!