Copying attachment to Initiated From record

Cirrus
Kilo Sage

Hi,

We want to be able to copy attachments from a work order task back to the initiated from Incident record when an engineer adds a site photo or some other graph image. We have an async business rule running after insert/update on the wm_task table:

 

(function executeRule(current, previous /*null when async*/) {

    GlideSysAttachment.copy("wm_task",current.sys_id,"incident",current.initiated_from.sys_id);

})(current, previous);
 
The problem is that because there is no condition on the BR, it triggers every time a worknote is inserted, so the incident is being swamped with attachment copies. The only possible condition appears to be Work Notes changes, which of course it will do every time an update is made.
 
Can anyone suggest a way around this please
 
 

 

1 ACCEPTED SOLUTION

Kristy Merriam
Administrator
Administrator

One idea may be to put the BR on the attachment table rather than the wm_task table. You could then specify the condition in which you want the BR to run i.e. table=wm_task, etc.

View solution in original post

2 REPLIES 2

Kristy Merriam
Administrator
Administrator

One idea may be to put the BR on the attachment table rather than the wm_task table. You could then specify the condition in which you want the BR to run i.e. table=wm_task, etc.

Thanks for your response. We managed to solve this from the following article that came up in related content as I posted

https://www.servicenow.com/community/developer-articles/copy-attachments-better-with-subflow/ta-p/29...