How to add attachment on the HR case using catalog attachment variable type?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2023 06:00 AM - edited ‎09-12-2023 06:53 AM
Hi,
Hope you are doing well.
I have an 'attachment' type variable in my record producer. When the user uploads any attachment, I want the attachment to get saved in the record created. But instead, it is hiding it.
I can see the entry created in sys_attachment but not on case,
How can I remove ZZ_YY before copying. I written this business rule
Async - insert. it's not working. can you help?
If I remove this zz_yy from sys_attachment manually from the table then it's adding the attachment on the case.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2023 09:51 AM
It's not showing on the top in the attachment header. I want this "test file.txt" on the top.
it's not showing in the attachments tab. can you please help me on this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2023 09:47 PM
This is working for me. Thank you so much.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2023 09:43 PM
Glad to know that my script worked.
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
‎09-13-2023 10:04 PM
(function executeRule(current, previous /*null when async*/ ) {
var gr = new GlideRecord("sys_attachment");
gr.addQuery("table_name", "ZZ_YY" + current.getTableName());
gr.addQuery("table_sys_id", current.sys_id);
gr.query();
if (gr.next()) {
gr.table_name = current.getTableName();
new global.VariableUtil().copyAttachment(gr.sys_id, current.getTableName(), current.sys_id);
gr.update();
}
It's not working. can you correct it if I'm missing something?
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-13-2023 10:11 PM
give business rule as Async insert
You said it's working fine earlier.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader