How to convert REQ to incident

Anusha chandra
Tera Contributor

Hi, I have a request from a Client that he wants to convert REQ to incident directly similar to the way as incidents are converted to REQ. There is no OOTB feature(that I am aware of) which I can use to implement it. So is there a script in the UI action which I can use to implement it? It should be visible in the header. 

Anushachandra_0-1691488962282.png

 

Thank you

 

 

 

1 ACCEPTED SOLUTION

Hi @Anusha chandra,

 

If you want a similar functionality as the UI Action on the Requested Item table, you could just to an Insert and stay on that UI Action, change the table to Requested Item, and remove line 3, 5 and 6 from the script.

In case you need more fields to be prepopulated in the incident, you will have to change the url.set line to include those in the sysparm_query.

So for example if you want to prepopulate the short description it would be something like

 

var url = new GlideURL("incident.do");
url.set("sys_id" , "-1");
url.set("sysparm_query", "caller_id=" + current.requested_for + "^parent=" + current.sys_id + "^short_description=Incident created from Request " + current.number); 
action.setRedirectURL(url.toString()+"");

 


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

View solution in original post

4 REPLIES 4

Peter Bodelier
Giga Sage

Hi @Anusha chandra,

I assume you want to create an incident, related to the request and not changing the class from Request to Incident?

If so, you could use the Create Incident UI Action on the interaction or on the Requested Item table as example to fulfill your request.

If you want to convert it, I will highly advise against that.


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

Hi Peter, 
Thank you for your response. I am aware of the Create Incident UI Action but it is for requested item table. I would like to create incident from REQ(sc_request table) directly using UI action. Can you please let me know how to do it?

Hi @Anusha chandra,

 

If you want a similar functionality as the UI Action on the Requested Item table, you could just to an Insert and stay on that UI Action, change the table to Requested Item, and remove line 3, 5 and 6 from the script.

In case you need more fields to be prepopulated in the incident, you will have to change the url.set line to include those in the sysparm_query.

So for example if you want to prepopulate the short description it would be something like

 

var url = new GlideURL("incident.do");
url.set("sys_id" , "-1");
url.set("sysparm_query", "caller_id=" + current.requested_for + "^parent=" + current.sys_id + "^short_description=Incident created from Request " + current.number); 
action.setRedirectURL(url.toString()+"");

 


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

Thank you so much Peter 🙂 It is working for me.