Alternative for dot walking in workflow script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2024 08:17 AM
Hello Team,
I have one requirement in workflow script to set requested for request to variables from RITM. I used as "
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2024 08:38 AM
I think you can try something like below:
var ritm = new GlideRecord('sc_req_item');
if (ritm.get(current.variables.ritm)) { // Assuming 'ritm' is the variable holding the RITM sys_id
var requestedFor = ritm.variables.requested_for; // Assuming 'requested_for' is the variable name
current.requested_for = requestedFor;
} else {
gs.info('Failed to get the associated RITM.');
}
Please Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2024 08:45 AM
Hi,
They don't want to use dot walking for
var requestedFor = ritm.variables.requested_for;
Is there any other way to achieve this line in script?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2024 08:38 AM
You would need a run script activity in your Workflow
var gr = new GlideRecord("sc_request");
gr.addEncodedQuery("sys_id="+current.request);
gr.query();
if(gr.next()){
gr.requested_for = current.variables.requested_for;
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2024 08:44 AM
Hi,
They don't want to use dot walking for gr.requested_for = current.variables.requested_for; Is there any othe way to achieve this in script?