- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2023 02:49 PM
Hi,
I was advised by HI support to create a before insert business rule to copy attachments from the Business Application Request record (business_app_request) to the Business Application (cmdb_ci_business_app) record using the following script. HI provided this reference GlideSysAttachment | ServiceNow Developers.
It works great when I know the sys_id.
var source_sysId = '1d3aca2e1bb5a9503c5f97d4bd4bcbe6';
var gr = new GlideRecord('business_app_request');
gr.addQuery('sys_id', source_sysId);
gr.query();
while (gr.next()) {
Packages.com.glide.ui.SysAttachment.copy("business_app_request", gr.sys_id, "cmdb_ci_business_app", current.sys_id);
}
The business_app_request is created from a catalog request and the flow creates the cmdb_ci_business_app. Since copying the attachment is not standard functionality, I need to create a BR to do this.
Can someone clarify how to access the source record, in this case the business_app_request that is created from the catalog request, to get the attachment sys_id?
Thanks,
Mollie
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2023 09:21 AM - edited 03-29-2023 09:21 AM
Hi,
Are you able to insert the copy attachment action as part of this flow? Where you have access to both the sys_id for both the business app and the cmdb_ci_business_app?
https://docs.servicenow.com/bundle/rome-servicenow-platform/page/administer/flow-designer/reference/... -- this can be done without code and just dragging the relevant pills to the configuration.
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2023 02:41 PM
Hi @Mollie V
The copy attachment action is pretty straightforward, you just needed to have access to the objects/records for the inputs. Without looking directly at your flow and without seeing all the inputs to it (you had the inputs cut off in your screenshot in your last reply), I couldn't see if there was something else you could utilize (such as setting a flow variable to the sys_id, etc. and then using that instead).
In any case, the point was to use a no-code option, if you can, and not use a business rule which you were stuck on anyway because you didn't have the sys_id you needed. So in either case, some sort of lookup most likely would have been needed.
In the end, great work and I'm very happy to see that you took what I recommended and then ran with it and achieved success.
If possible, please review this thread and consider marking any reply as Helpful, if it was and if my reply that guided you towards the Copy Attachment action helped resolve your issue, please mark that as "Accept Solution". I'd also recommend you also mark your last reply here as "Accept Solution" as well (as you can mark more than one as accepted).
Great work! and take care! 🙂
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2023 02:41 PM
Hi @Mollie V
The copy attachment action is pretty straightforward, you just needed to have access to the objects/records for the inputs. Without looking directly at your flow and without seeing all the inputs to it (you had the inputs cut off in your screenshot in your last reply), I couldn't see if there was something else you could utilize (such as setting a flow variable to the sys_id, etc. and then using that instead).
In any case, the point was to use a no-code option, if you can, and not use a business rule which you were stuck on anyway because you didn't have the sys_id you needed. So in either case, some sort of lookup most likely would have been needed.
In the end, great work and I'm very happy to see that you took what I recommended and then ran with it and achieved success.
If possible, please review this thread and consider marking any reply as Helpful, if it was and if my reply that guided you towards the Copy Attachment action helped resolve your issue, please mark that as "Accept Solution". I'd also recommend you also mark your last reply here as "Accept Solution" as well (as you can mark more than one as accepted).
Great work! and take care! 🙂
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!