The CreatorCon Call for Content is officially open! Get started here.

How to dot walk from a parent request to child task in a workflow run script?

mohammedunwala
Giga Contributor

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

7 REPLIES 7

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.


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


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.



find_real_file.png