BR review: copy worknotes and comments from sc_task to sc_req_item

Bcrant
Tera Contributor

Hello, everyone!

Looking for some guidance on a business rule that we're using to copy comments and worknotes from tasks to RITMs. I've attached the rule to this post for review. The issue that we're seeing is that when multiple RITMs are associated with a REQ (Order Guide for example), the comments and worknotes from the tasks are copying to ALL RITMs instead of only the RITM that the task is associated with.

Any help is greatly appreciated!

 

4 REPLIES 4

Musab Rasheed
Tera Sage
Tera Sage

Hello,

Go through below Article, it has solution

https://community.servicenow.com/community?id=community_article&sys_id=4750aecfdbf3d814fa192183ca961958

If you want for latest comment or worknotes then just append with below

current.comments.getJournalEntry(1)

Regards

Please hit like and mark my response as correct if that helps
Regards,
Musab

Bcrant
Tera Contributor

@Musab Rasheed  thank you for your reply. The issue isn't with the latest comment but instead it's with copying the comment or worknote to a RITM that the task is not associated with. Multiple RITMs under one parent REQ. Ideally the task comment or worknote should only copy to the parent RITM. I'm still reviewing and will reply back if I find a solution.

See in highlighted part, you are comparing REQ instead of RITMs hence it is copying to all RITMs instead of just parent RITM

find_real_file.png

So replace highlighted part with below query at both places.

.addQuery('sys_id', current.request_item);

This should work.

Please hit like and mark my response as correct if that helps
Regards,
Musab

Musab Rasheed
Tera Sage
Tera Sage

Hello,

If you are fine with my response, Please hit like and mark my response as correct if that helps.

Regards

Please hit like and mark my response as correct if that helps
Regards,
Musab