Populate "Requested for" and "Opened by" fields on RITM

vijay39
Giga Expert

Hi Friends,

I have created a catalog item. There are 2 fields (both are reference fields referencing to USer table), Requestor (u_requestor) and Behalf of (u_behalf_of) on the form.

When i submit that item, Request is getting created and corresponding RITM is also getting created. In work flow i have written a run script to populate values on RITM. I want to populate Requestor field value in Opened by in RITM and Behalf of value in Requested for field in RITM. How can i populate those values into them?

Please note my workflow is on RITM, and after begin activity, i written a code in Run Script activity like, 

current.opened_by = current.variables.u_requestor;

But its not working. Can some one help me on this?

 

 

Regards,

VIjay

2 REPLIES 2

pavan9885
Tera Guru

create a before business rule on req item.

 

var grRITM = new GlideRecord('sc_req_item');

 

grRITM.addQuery('request', current.sys_id);

 

grRITM.query();

 

while (grRITM.next()) {

 

  if (!JSUtil.nil(grRITM.variables.requested_for)) {

 

      current.requested_for = grRITM.variables.requested_for;   //I am assuming requested_for variable here from form.

 

  }

 

}

 

Note : Please mark my answer correct / Helpful so this question will not wipped out from the community .

Thanks Pavan for the response.

But i have glide record the request table, and populated the fields that reflects to ritm in runscript activity.

Its working now.

 

Regards,

Vijay