Don't show generated docs as attachments until approved
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-14-2024 01:09 AM
Hello,
I have a button at the Case (sn_customerservice_case) table that generates a PDF related to this case. I send this generated document for approval. What I need to do is to have this attachment not shown in the case record if it is not approved. after it is approved it should be shown in the record (in the top and related lists).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-14-2024 05:25 AM
you can use READ ACL on sys_attachment with condition as this
Table=Case
In script check the status of case is approved or not; if not then set answer=false.
Sample script in ACL. enhance it as per your requirement
var gr = new GlideRecord("sn_customerservice_case");
gr.addQuery("sys_id", current.table_sys_id);
gr.addQuery("state","approved"); // give correct query here
gr.query();
answer = gr.hasNext();
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
‎08-14-2024 05:39 AM
Have the button create the PDF as attachment to the approval record and once approved, copy it to the case.
or
Have the button create a case task with the PDF attached to that and create the approval record for the case task and once approved, copy the PDF to the case.
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark