UI Action code for Agent Workspace

tiago1
Tera Contributor

I created a new subflow to transfer HR cases to IT requests. I'm calling the subflow from an UI action and everything works great on the regular UI but I'm struggling to make this work on the Agent Workspace.

 

This is the code I'm using on the UI action script, what changes I need to make in order for this to work on the "Workspace Client Script"?

 

(function() 
 {
	try 
	{
		var rec_id = current.sys_id;
		var gr = new GlideRecord(current.getTableName());
		if (gr.get(rec_id)) 
		{
			var inputs = {};
			inputs['var_short_desc'] = current.short_description;
			inputs['var_desc'] = current.rich_description;
			inputs['var_requestor'] = current.opened_for;
			inputs['var_number'] = current;
			//gs.addInfoMessage("var_requestor: "+inputs['var_requestor']);
			sn_fd.FlowAPI.getRunner().subflow('global.transfer_hr_case_to_it').inForeground().withInputs(inputs).run();
		}
	} 
	catch (ex) 
	{
		var message = ex.getMessage();
		gs.error(message);
	}

}
)();

 

 

 

1 REPLY 1

AnubhavRitolia
Mega Sage
Mega Sage

Hi @tiago1 

 

In the UI Action, you have a Form section "Workspace". There make "

 

Than copy your Script in Workspace Client Script field. It should work in Agent Workspace also than.

 

AnubhavRitolia_0-1690549133044.png

 

 

Please mark this as correct answer and helpful if it resolved, or mark this helpful if this help you to reach towards solution.

Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023