The Zurich release has arrived! Interested in new features and functionalities? Click here for more

How to set value in workflow

RudhraKAM
Tera Guru

Can some one help me with this script

I have a table u_test_results  in which there is a record XYZ1 ( with name as u_name)

I have a catalog item on which we have a variable which is reference field of above table , when a user picks the above record and place a request we need to set a current time on other table 

in the workflow i am writing this script and its not setting the time . Can you please help me fixing this issue .

The other table is u_solution which has 2 fields 

1 closed date and 2.record for (this field contains XYZ record and its a reference field too) 

 

var GOT= parseInt(current.variables.u_name.getDisplayValue());
var gr = new GlideRecord('u_solution ');
gr.addQuery(u_recorded_for, GOT);
gr.query();

if (gr.next()) {
gr.u_closed_date = current.opened_at;
gr.update();
}

1 ACCEPTED SOLUTION

Harsh Vardhan
Giga Patron

Updated Script:

 

 


var tenant= new GlideRecord('u_delegated_management_environment');
if(tenant.get('faf6c496dbfd3380cebc550a48961983')) {
var test = tenant.name;


var gr = new GlideRecord('u_mou');
gr.addQuery('u_service.name',test);

gr.query();
while(gr.next()) {

gr.u_end_date=gs.nowDateTime();
gr.update();

}
}

View solution in original post

22 REPLIES 22

Mike Patel
Tera Sage

try

var GOT= parseInt(current.variables.u_name.getDisplayValue());
var gr = new GlideRecord('u_solution');
gr.addQuery('u_recorded_for', GOT);
gr.query();
if (gr.next()) {
	gr.u_closed_date = current.opened_at;
	gr.u_recorded_for = current.sys_id;
	gr.update();
}

Thanks Mike ,, the end date didnt populated ( its not working )

Did it update below field ?

u_recorded_for 

yes that is same as  u_name