We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Create Change UI Action query

Cirrus
Kilo Sage

Hi,

We would like to create a change from a catalog task, and can achieve this simply by using the following script in a ui action:

var url = new GlideURL("change_request.do");
url.set("sys_id" , "-1");
url.set("sysparm_query" , "^parent=" + current.sys_id);
action.setRedirectURL(url.toString()+"");
 
is there a way to amend the script to set other fields, for example the Short Description, from the parent catalog task??
1 ACCEPTED SOLUTION

Not applicable

Yes, you need to add it on one set(). Like this:

var url = new GlideURL("change_request.do");
url.set("sys_id" , "-1");
//url.set("sysparm_query" , "^parent=" + current.sys_id);
url.set("sysparm_query" , "^short_description=" + current.short_description +^parent=" + current.sys_id);

action.setRedirectURL(url.toString()+"");

View solution in original post

10 REPLIES 10

Not applicable

Yes, you need to add it on one set(). Like this:

var url = new GlideURL("change_request.do");
url.set("sys_id" , "-1");
//url.set("sysparm_query" , "^parent=" + current.sys_id);
url.set("sysparm_query" , "^short_description=" + current.short_description +^parent=" + current.sys_id);

action.setRedirectURL(url.toString()+"");