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.

Synchronize catalog task activity and requested item activity

Tadz
Kilo Sage

Hi, how do we synchronize the catalog task activity and requested item activity.

I have successfully synchronize them both using BR for catalog task and BR for Requested Item.

The when to run of my BR's are:

When: before

Update

The problem is, the activity in the catalog task are duplicated.

See the screenshots below:

task_sync1.PNG

task_sync2.PNG

I know that the one causing the duplication is because of the 2 Business rule running. In which the Requested Item BR will be triggered

when the Catalog Task added a work notes.

I also tried adding

if(!current.work_notes.getJournalEntry(-1).split("\n\n")[0].indexOf('Work notes')){

gr.comments = comments;

gr.update();

}

It stops the duplication of the catalog task activity.

But the comments from requested item to catalog task. doesn't work anymore.

Thanks,

Tadz

8 REPLIES 8

K10
Kilo Guru

Hi,



Here is the catch which i can think on top of my head. I believe the Business rule is been called more than one time from Request level causing multiple updates.


I believe that you are trying to update the Sc_task from sc_req_item on every update when the comment is updated.



You can add a new condition on this BR as current.comments.changes() which will ensure that the BR runs only on comment change and then you can straight away update the respective sc_task within it.



Not sure i exactly understood your logic.


Hi K10,



Thanks for the way. But still doesn't work.



Here is my code:


if(current.comments.changes()){


  gr.comments = comments;


  gr.update();


  }



Thanks,


Tadz


Is there a way to disable the requested item BR if the catalog task BR is executed?



Thanks,


Tadz


Ever figure this one out?