- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2023 05:56 AM
Hi Experts,
I was trying to attach the files of incident record to record producer on click of UI button.
I've tried 'GlideAttachment.copy()' which helps only from record to record, but not record to form.
Can you please advise, how to make this work.
Thanks in advance..!!
Regards,
Naveen.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2023 07:43 AM
do this
1) create a string variable on record producer and give it higher order
2) pass the incident record sysId from URL parameter when you redirect user to record producer
3) use onLoad catalog client script and get that URL parameter value and set it in variable and hide it
4) then use Record producer script to copy attachment
GlideSysAttachment.copy('incident', producer.variableName, 'target_table', current.sys_id);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2023 02:26 AM
Hi @Ankur Bawiskar ,
what's the motive of showing the files on record producer? - Files will be the reference to technical teams to work on the demand request.
Did you try g_form.getUniqueValue() for portal? - YES, It returns me the Sys_id value of Record Producer item.
Note: I've to build the same requirement in custom table (which holds the templates of shipping invoice). Where end-users filter the data in custom table with their requirements and incase, if users find the partial match template record, end-users will click on the demand request button to modify the selected template .
Regards,
Naveen.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2023 02:52 AM
so what's the error when you are using the script?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2023 03:28 AM - edited 10-09-2023 03:37 AM
Hi @Ankur Bawiskar ,
There is no error, sys_id of Record Producer item('sc_cat_item_producer') is of no use, bcoz it doesn't show the attachments on the portal form.
We should be able to attach the attachments on the target table record of the Record Producer.
Let us assume, I've manually attached an attachment on the RP given below.
This attachment is stored in the target table below with random generated sys_id before the form is submitted.
I was trying to fetch that sys_id before loading the form.
Hope you understood the issue.
Regards,
Naveen.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2023 06:47 AM
that is not possible.
if your actual use-case is to transfer file from incident record to the target record generated from record producer then there is another way for this
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2023 07:40 AM
Hi @Ankur Bawiskar ,
What is the other way you recommend for this requirement?
Could you help me with the details.
Regards,
Naveen.