setValue of a field is not working in async insert/update Business rule

Renu9
Tera Contributor

Hi All,

I am writing an async Insert/Update business rule to update a field value(Ex: TestA) on RITM based on RITM's Approval field value.

If Approval field value is either approved/rejected, then only I need to populate some value in  'TestA' 

There are few RITM's with approver and few with no-approvers

Async Insert/Update

current.setValue('TestA', time);

(or)
        current.TestA = time;

Both the above methods are not working in async BR, Please guide

 

10 REPLIES 10

Arav
Tera Guru
Tera Guru

Hi Renu,

You will have to add "current.update()" if not already done as it's an async BR.

On a related note, why can't this be done via a before update BR as you are updating the same object ?

Thanks,

Arav

Renu9
Tera Contributor
I tried with before update BR as well, but it is not fulfilling one of my condition. It is working fine if I am having any Ritm which is having approval, but if there is no approval, approval field value will come as Approved, but when I kept the logs, it is coming up as REQUESTED, hence my BR is not working at that time. Please guide me in this scenario

You may have to troubleshoot the related workflow (or FD) to identify the issue.

Please click "Show Workflow" link on RITM to see at which step the "Approval" field was set.

If workflow is not an issue, please check other BRs to see if this is field is getting changed.

Hope all of these suggestions have helped.

Thanks,

Arav

Sagar Pagar
Tera Patron

Hi,

Can you share your complete script here. It will be helpful for troubleshooting.

 

Thanks,

Sagar Pagar

 

The world works with ServiceNow