How do you copy an attachment from one record to another in Kingston's Flow Designer?

maynartt
Kilo Guru

We have a requirement to create a record in our scoped app when a record with specific values is created in the Incident (incident) table.  We'll be upgrading to Kingston soon, and would like to take advantage of its Flow Designer. 

We've recently spun up a separate Kingston instance where we can experiment, and I'm able to set up the flow and create that record.  But one of the requirements is to also copy any attachments that might also be placed on the Incident to our scoped app's record.  I can't see how that is done using Flow Designer.  Does anyone have any ideas?  I looked in docs and Kingston release notes and nothing was obvious, but I may have missed it.  Thanks!

1 ACCEPTED SOLUTION

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hello,

 

You need to create a custom action to copy attachments. We have covered it during the TechNow Episode 44(starts at 51:20) and the script is referenced below. You can adjust it as per your req.

https://www.youtube.com/watch?v=GtAFuOgnfU8&t=3071s

 

(function execute(inputs, outputs) {

// ... code ...

var x = GlideSysAttachment.copy('incident', inputs.incident_sysid, 'problem', inputs.problem_sysid);

var list = global.j2js(x); outputs.attachmentSysId = list.join(','); })(inputs, outputs);

 

Please let me know if you are blocked.

 

Thanks,

Pradeep Sharma

 

View solution in original post

3 REPLIES 3

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hello,

 

You need to create a custom action to copy attachments. We have covered it during the TechNow Episode 44(starts at 51:20) and the script is referenced below. You can adjust it as per your req.

https://www.youtube.com/watch?v=GtAFuOgnfU8&t=3071s

 

(function execute(inputs, outputs) {

// ... code ...

var x = GlideSysAttachment.copy('incident', inputs.incident_sysid, 'problem', inputs.problem_sysid);

var list = global.j2js(x); outputs.attachmentSysId = list.join(','); })(inputs, outputs);

 

Please let me know if you are blocked.

 

Thanks,

Pradeep Sharma

 

maynartt
Kilo Guru

Works great.  Thanks very much for your help.  I didn't need the resulting list of sys_ids of the attachments created, therefore didn't have to worry about creating a duplicate of j2js in our scoped app - just commented that part out. 

You are very welcome. Let me know if that answered your question. If so, please mark the response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list. Thank you

 

Thanks,

Pradeep Sharma

@sharma_pradeep