Create Change from Requested ITEM

Amey8
Tera Guru

I have a requirement to create change request from RITM. I have enabled the UI Action 'Create Change' on the sc_req_item table.

 

Its working but its opening the New change record directly and setting type to 'Normal'

 

I want it to open the model page where i can choose from Standard , Emergency Normal model Types..

 

Amey8_0-1744131159433.png

This is the current UI Action script

var url = new GlideURL("change_request.do");
url.set("sys_id", "-1");
url.set("sysparm_query", "^parent=" + current.sys_id + "^short_description=" + current.number + " - " + current.cat_item.name + "^description=" + current.variables.business_justification + '^u_requested_item=' + current.sys_id);
action.setRedirectURL(url.toString() + "");
 
I tried changing the url but then the UI Action is not clickable.
1 ACCEPTED SOLUTION

Hello @Amey8 ,

 

If you want this UI Action to work both in the core UI and in Workspace you need to make the following changes to it:

 

  • Check the Client checkbox (set to enabled)
  • Set OnClick to:
redirectToCR()​
  • Change the Script to:
function redirectToCR() {
	var url = '/new_change_redirect.do?sn_new_chg_origin=module';
	location.replace(url);
}​
  • Change the Workspace Client Script to:
function onClick(g_form) {
	var url = '/new_change_redirect.do?sn_new_chg_origin=module';
    top.window.open(url, '_blank');
}​

I assume you want the Workspace button to open the URL in a new tab. If this is not the case then use "location.replace", like in the regular script.

 

Regards,

Robert

View solution in original post

9 REPLIES 9

Shivalika
Mega Sage

Hello @Amey8 

 

So the URL is not of the change interceptor. 

 

Just copy the change interceptor url and update your script - 

 

var url = 'change interceptor url' ; // update it

 

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

 

Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket. 

 

Regards,

 

Shivalika 

 

My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194

 

My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY

Hello @Shivalika ,

i have a follow up question .

what if we want to create only preapproved  page like below in screenshot?

 

Aarushi1991_0-1744220217921.png

change interceptor URL will give entire other section also like pinned , models,preapproved ,all

 

Hello @Aarushi1991 ,

 

The preapproved changes are part of the Standard Change Catalog, so you can use the following alternative URL:

 

// use this for a redirect to the Create Change landing page
//var url = '/new_change_redirect.do?sn_new_chg_origin=module';

// use this for a redirect to the preapproved changes (Standard Change Catalog)
var url = '/com.glideapp.servicecatalog_category_view.do?v=1&sysparm_parent=b0fdfb01932002009ca87a75e57ffbe9&sysparm_cartless=true';

action.setRedirectURL(url);

 

Regards,

Robert

Hi @Robert H ,

 

thanks for response ,

what do i need parent records to current RITM , i tried with below code but it didn't work .

var url = new GlideURL("/com.glideapp.servicecatalog_category_view.do?v=1&sysparm_parent=b0fdfb01932002009ca87a75e57ffbe9&sysparm_cartless=true");
url.set("sysparm_query" , "^parent=" + current.sys_id);
action.setRedirectURL(url.toString()+"");