How to retrieve a variable value from a RITM and Populate on a the same field in a new request, Thanks so much.

Maala
Kilo Contributor

Hi, Please help on how to retrieve a variable value from a RITM and Populate on a the same field in a new request, Thanks so much.

10 REPLIES 10

Maala
Kilo Contributor

any example script and steps will be a great help, Thanks

Hi,

Ok so you need to get the variable value of previous RITM submitted by that user and auto-populate it in the variable

Can you share how to identify same user's previous request? if there any variable which holds user record

For this you would require onload client script and combination of GlideAjax

If my answer solved your issue, please mark my answer as Correct & 👍Helpful based on the Impact.

Regards
Ankur

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

user  query can be on sys_user table.

 current user Variable is : var req = g_form.getReference('requested_by_name',callback);

---------------------------------------------------------------------------------------

have done  as shown below to query a catalog item approval status,

var gr = new GlideRecord('sysapproval_approver');
gr.addQuery('state','requested');
gr.addQuery('sysapproval.sys_item_name', 'sc_req_item');
gr.orderBy('approver');
gr.query();
while (gr.next())
{
var documentId = gr.document_id;
var req = new GlideRecord('sc_req_item');
req.addQuery('sys_id', documentId );
req.addQuery('cat_item','sys_id_of_item');
req.query();

gs.log(req);
gs.log(gr);

while(req.next())
{
gs.eventQueue('open.approval.reminders.********', gr, gr.approver.sys_id);
}

}

Hi,

You need onload catalog client script + GlideAjax

the script you shared doesn't look will achieve your requirement

Is this for your personal instance? if yes then if you are ok you can share details

Regards
Ankur

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

Details?