How to dot walk from a parent request to child task in a workflow run script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2016 04:24 AM
Hi everyone,
I have a run script in my workflow (which is running on the request) to update the value of a field in a 'store_database' table with the current value of the field that is sitting on a task within that request.
Script:
updateScript();
function updateScript() {
var gr = new GlideRecord('x_rommi_branded_rs_store');
gr.addQuery('sys_id', current.u_location_dealer_name);
gr.query();
while (gr.next()){
gr.u_lease_expiry = current.parent.u_lease_expiry;
gr.update();
}
}
Of course, the above script is not working as my current field is sitting on the task table instead of request and my workflow is running on the request table. I am trying to dot walk from parent (request) to child (task) here so that I can get the value of that field. Any thoughts on where I am going wrong?
Thanks,
Mohammed
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2016 04:51 AM
Hi Mohammed,
What are the fields involved relating these tables together? Which is the child and which is the parent? That seems to be the critical part of linking your data model.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2016 04:59 AM
Hi Chuck,
So, u_location_dealer_name (type: reference) is the common field between the request and the database tables mentioned above.
And, parent (type: reference) is the common field between the request and the task tables mentioned above.
Regards,
Mohammed

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2016 05:24 AM
Hi Mohammed,
I apologize. I'm just not able to get a vision of the data model based on your descriptions. Could you go to System Definition> Tables and Columns, select the table, and click the button labeled "Schema Map", then expand the columns section (click +) and you should have an image similar to below for each of your tables.