Download a completed RITM with all variables and attachments?

Alan42
Tera Guru

I'm wrapping up a the build of a new claim process and the business owner asked if there is any way to download a completed RITM with all the completed variable fields and attachments, including those from the tasks.    I found the 'Requested Item Details' report that can be exported.    That doesn't provide the variables.    With the solution we're retiring he just manually exports pages and attachments and builds a binder for each claim he can pass on to the legal department of our parent company.    It would be nice to just download everything with one click.  Are there any options to do this?    

1 ACCEPTED SOLUTION

Alan42
Tera Guru

I ended up creating a notification off sc_req_item and the director will use a UI action button to generate an email to legal.   I was able to pull in all task fields without issue.   I ended up copying the task attachment to the RITM so my email attachment script will pick them up.   Less than 2 MB per year in the workflow so no bloat danger.    Here is the script support helped me put together for a run script utility in the workflow.    

 

// Query for all tasks related to the parent request item
var taskGr = new GlideRecord('sc_task');
taskGr.addQuery('request_item', current.sys_id);
taskGr.query();

// Iterate through each task and perform attachment copy
while (taskGr.next()) {
    var attach = new GlideSysAttachment();
    attach.copy('sc_task', taskGr.sys_id, 'sc_req_item', current.sys_id);
}

View solution in original post

3 REPLIES 3

Mark Manders
Mega Patron

That can't be done OOB. You will completely create the code for this, especially if the attachments need to be included as well. 

But, you are using ServiceNow for this. Everything is in the system, why get it out of there to put into a binder? Provide the legal department access to the system and they have everything they want.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Separate operating company entirely.  They don't want access to our systems, just information as needed.   

Alan42
Tera Guru

I ended up creating a notification off sc_req_item and the director will use a UI action button to generate an email to legal.   I was able to pull in all task fields without issue.   I ended up copying the task attachment to the RITM so my email attachment script will pick them up.   Less than 2 MB per year in the workflow so no bloat danger.    Here is the script support helped me put together for a run script utility in the workflow.    

 

// Query for all tasks related to the parent request item
var taskGr = new GlideRecord('sc_task');
taskGr.addQuery('request_item', current.sys_id);
taskGr.query();

// Iterate through each task and perform attachment copy
while (taskGr.next()) {
    var attach = new GlideSysAttachment();
    attach.copy('sc_task', taskGr.sys_id, 'sc_req_item', current.sys_id);
}