How to create an UI action button to convert an incident to a Request.

velvet
Mega Guru

If an incident was submitted incorrectly and it really needs to be a request I need the Convert to Request to do the following:

1.  take you to the Hompage of the Service Catalog so that you can select what type of request it is.

2.  After you select the type of request, it pulls the information from the incident to the request, such as caller, additional comments and work notes.

3. Once the request is submitted it displays at the top the Request number and also states that the incident was canceled/deleted/

3.  It cancels/deletes the incident automatically.

I have seen scripts in the community for this but not all in one script.  I am new to scripting , this would be greatly appreciated.

 

6 REPLIES 6

What error are you getting?

Is the error regarding item as in your script I am not seeing the item variable anywhere?

Also, you want a Dialog that opens when you click on the UI Action. Can you please let me know what is the purpose for that? We may be having a difference in the requirement understanding.

Regards,

Manan

 

Community Alums
Not applicable

This is what I did, for the UI Action:

current.update();

var ppm_ref = 'sysparm_ppm_ref='+ current.sys_id.toString();
var url = 'com.glideapp.servicecatalog_cat_item_view.do?v=1&sysparm_id=xxxxxxCAT_ITEM_SYS_IDxxxxxx'; // sys_id should have suitable property
gs.setRedirect(url+'&'+ppm_ref);

 For the Catalog load script, I used:

function onLoad() {
	var proj = getParmVal('sysparm_ppm_ref');

	if (proj) {
		g_form.setValue('u_project_ref', proj);  
	}
}

function getParmVal(name){
	var gURL = new GlideURL();
	gURL.setFromCurrent();
	var proj = gURL.getParam(name);
	
	return proj;
}