Don't show generated docs as attachments until approved

KleoKocaqi
Tera Contributor

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). 

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@KleoKocaqi 

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.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Mark Manders
Mega Patron

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