Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to prevent the updates of state changes in Activity log multiple time

Intakhab Khan
Tera Contributor

Hi,

I have a requirement in which after state changes to Assigned, an additional comments will be added.

Comments will be : "Acknowledged the incident. Investigation is going on and will provide the update shortly."

I'm doing this using After-update Business Rule and here is the script which I'm using:

 
if(current.incident_state.changes() && current.incident_state == '2') { // State = Assigned(2)
        current.comments = "Acknowledged the incident. Investigation is going on and will provide the update shortly.";
        current.update();
 
But the issue is, getting fields(state) update in activity log 2 times for state : Assigned was Open. (May be due to other BR is acting upon it or don't know).
 
But how can I restrict it for only first update or prevent it to update 2 times in Activity log.
 
Notes : I can't use current.setWorkflow(false).
 
Thanks,
Intakhab

 

1 ACCEPTED SOLUTION

Abbas_5
Tera Sage
Tera Sage

Hello @Intakhab Khan,

For similar kind of issue, please refer to the below link:
https://www.servicenow.com/community/itsm-forum/field-changes-capturing-twice-in-activity-log/td-p/6...

 

If it is helpful, please mark it as helpful and accept the correct solution.

Thanks & Regards,

Abbas Shaik

View solution in original post

2 REPLIES 2

Abbas_5
Tera Sage
Tera Sage

Hello @Intakhab Khan,

For similar kind of issue, please refer to the below link:
https://www.servicenow.com/community/itsm-forum/field-changes-capturing-twice-in-activity-log/td-p/6...

 

If it is helpful, please mark it as helpful and accept the correct solution.

Thanks & Regards,

Abbas Shaik

Intakhab Khan
Tera Contributor

Hi @Abbas_5 ,

Thanks for the reply and I changed my After-BR to Before and commented current.update(); and now it's working.

 

Thanks & Regards,

Intakhab Khan