- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-05-2023 03:51 AM
How to add a default attachment to an attachment variable in a catalog item so that the user can download that attachment and add the updated attachment to that variable.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-05-2023 04:21 AM
Hi @sreeshsurendran ,
You can achieve this using the following steps:
Step 1 : Attach the attachment to the catalog item, which you want to show up as default, example:
Step 2 : Navigate to the 'sys_attachment' table, you'll notice that a new record has been created - copy the 'sys_id' of this record.
Step 3: Create a onLoad catalog client script
function onLoad() {
g_form.setValue('attachment','b3db64fa97aea91082f2bb5ef053afb9'); // replace the sys_id with the one which you've copied in step 2
}
Result:
If my answer has helped with your question, please mark it as correct and helpful
Thanks,
Karan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-05-2023 10:08 AM
@Slava Savitsky - thanks for the feedback, that's a good catch
@sreeshsurendran - as a workaround for this, you can add your template in the description of the catalog item
Click on the link icon and then select the link list as your attachment
Change the title and text accodingly.
This method wont delete the attachment.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-05-2023 04:21 AM
Hi @sreeshsurendran ,
You can achieve this using the following steps:
Step 1 : Attach the attachment to the catalog item, which you want to show up as default, example:
Step 2 : Navigate to the 'sys_attachment' table, you'll notice that a new record has been created - copy the 'sys_id' of this record.
Step 3: Create a onLoad catalog client script
function onLoad() {
g_form.setValue('attachment','b3db64fa97aea91082f2bb5ef053afb9'); // replace the sys_id with the one which you've copied in step 2
}
Result:
If my answer has helped with your question, please mark it as correct and helpful
Thanks,
Karan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-05-2023 09:29 AM
With this approach, when the user clicks the Delete button in order to upload their own version of the file, the attachment will not only be removed from the form, but also from the catalog item definition, which means the next user will not see any default attachment.
Before pre-populating the attachment variable, you need to create a copy of the file and use the sys_id of that copy in the client script.
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-05-2023 09:54 AM
Hi @Slava Savitsky , could you please show the working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-05-2023 10:08 AM
@Slava Savitsky - thanks for the feedback, that's a good catch
@sreeshsurendran - as a workaround for this, you can add your template in the description of the catalog item
Click on the link icon and then select the link list as your attachment
Change the title and text accodingly.
This method wont delete the attachment.
Thanks!