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

Mark Roethof
Tera Patron
Tera Patron

Hi there,

You could achieve this within a Flow or Workflow which runs on the RITM. Reading the variable (current.variable.your_variable) and performing a GlideRecord update on the REQ.

Other option could be an after insert Business Rule on the RITM, which reading the variable and performing a GlideRecord update on the REQ. 

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

for accessing any variable value of RITM the syntax is below

if you are using this in workflow of RITM then current object refers to GlideRecord object of sc_req_item

current.variables.<variableName>

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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

Megha Padale
Giga Guru

Maala
Kilo Contributor

Thanks both, Mark and Ankur,

 I am not an expert in coding,But I have tried and learnt a bit.

I need to retrieve a variable value from a closed RITM and populate that value on the same field when a new request is logged, Any help please, Thanks

 Any example  script will be a great help.

My Item name of 'Bonus_time off'

Users  submit  the form, it gets approved and closed.

One of the variables on that (form)item is 'any time off taken already'

When same user  requests again, they need to fill in the hours taken already.

The requirement is to extract

the variable value, from the same user's previous request for that catalog item

 and  then populate the same  variable  in new request.

 Is it possible? 

 Please advise. Thanks again.