Generate a report via script and attach it as a PDF to another record.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2024 01:46 AM
Hi All,
I have a custom table, where that custom table stores some information related to users
My requirement is to generate a report from a custom table whenever a record got inserted and attach that report to the respective user's HR profile.
Is it possible to generate a report via script and attach it back to the record as a PDF. Please advise.
Thank You.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2024 02:58 AM
Hi @Community Alums,
Please refer to the community post link below for your requirement:
https://www.servicenow.com/community/platform-analytics-forum/create-a-report-using-scripting/m-p/1276725
Please mark my solution as Helpful and Accepted, if it works for you in any way!
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2024 12:17 AM - edited 10-14-2024 12:20 AM
Hi @anshul_goyal ,
Thank you for the thread. I have looked into it, and yes, we can schedule and send the report via email. However, in my case, how can I attach the report to a particular record?
Hi @Manikanta Kota / @Ankur Bawiskar / @Sandeep Rajput Can anyone of you provide some insights on this, that would be more helpful. Thank you in advance.
Thank You,
Sirraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2024 09:10 AM
Hi @Community Alums
you can try doing glide query to Update table_sys_id in the sys_attachment table of your attachment with the sys_id of your record. sample script :
var gr = new GlideRecord("sys_attachment");
if(gr.get("report_SYSID"))
{ gr.table_sys_id="record_sys_id";
gr.table_name="<record _table_name>"; // example if the record is on change table use change table name
gr.update();
}
Kindly mark the reply as a correct answer / helpful if it helped to solve your question.
Thanks,
Anwesha