- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2022 11:22 PM
I have a upload attachment functionality on our record producer on portal. When user uploads a file and submits the RP, we want the attachment to be added to a file attachment field in a table. Any leads as to how we achieve this.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2022 11:25 PM
Hi,
Since file attachment needs the sys_id of sys_attachment, you can simply assign the attachment from RP to the file attachment field like this -
gr.u_file_attachment_field = producer.upload_attachment_field; //replace the variable and field names as per your requirement.
Please mark correct/helpful if applicable.
Regards,
Shubham
Shubham Tipnis
ServiceNow Enthusiast
⭐️ 3x Rising Star (2022–2024) – ServiceNow Community
Sharing insights, use cases & real-world learnings from the Now Platform
Always learning. Always building.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2022 11:25 PM
Hi,
Since file attachment needs the sys_id of sys_attachment, you can simply assign the attachment from RP to the file attachment field like this -
gr.u_file_attachment_field = producer.upload_attachment_field; //replace the variable and field names as per your requirement.
Please mark correct/helpful if applicable.
Regards,
Shubham
Shubham Tipnis
ServiceNow Enthusiast
⭐️ 3x Rising Star (2022–2024) – ServiceNow Community
Sharing insights, use cases & real-world learnings from the Now Platform
Always learning. Always building.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2022 11:25 PM
Hi,
You can use following script in record producer script section to attach the attachment to current record, you can update it accordingly
var gr = new GlideRecord('sys_attachment');
if(gr.get(producer.attachment)){ //attachment field name
gr.table_name='incident'; //copy to table name
gr.table_sys_id=current.sys_id;//copy to record sys_id
gr.insert();
}
Mark my answer correct & Helpful, if Applicable.
Thanks,
Sandeep