Create Request from an Incident passing variables
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2017 11:04 AM
I need to convert INC to RITM and RITM to INC, but what I want is to lead the analyst to the catalog page so he can choose the new category and then have all the form filled with data from incident.
I tried doing something like this:
var url = "catalog_home.do?sysparm_view=catalog_default&sysparam_caller_id=";
Service catalog client:
var requester = getParmVal('sysparm_caller_id');
if (requester){
g_form.setValue('caller_id',requester);
But it didn't work, it seems like the parameter is lost after you navigate through service catalog.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2017 11:16 AM
Hi Juliana,
This is what I am using:
To recategorize incident to request, try:
var url = "catalog_home.do?sysparm_view=catalog_default&sysparm_processing_hint=setfield:request.parent="
url += current.sys_id;
action.setRedirectURL(url);
To recategorize request to incident, try:
var incident = new GlideRecord("incident");
incident.initialize();
incident.u_recategorized = current.sys_id; //if you have a recategorized reference field on the incident table
incident.caller_id = current.request.requested_for; //so the request's caller is the same as the incident
incident.short_description = current.short_description;
incident.description = "Recategorized from " + current.number;
incident.impact = 3; //change to your own values
incident.urgency = 3;//change to your own values
incident.description = current.variables.description;// + '\n' + "Recategorized from " + current.number + '\n' + current.cat_item.name ;
incident.insert();
return incident;
}
}
harel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2017 11:20 AM
Harel,
The problem with this, when clicking in the url to catalog from the incident action "Create Request" all the variables come out blank so the analyst has to fill everything again, and this will be a problem…
Obrigada,
Juliana Mendo
De: oharel
Enviada em: segunda-feira, 30 de outubro de 2017 16:18
Para: Juliana Mendo <jmraimundo@stefanini.com>
Assunto: Re: - Create Request from an Incident passing variables
<https://community.servicenow.com/?et=watches.email.thread>
Create Request from an Incident passing variables
reply from harel ben-sheffer<https://community.servicenow.com/people/oharel?et=watches.email.thread> in IT Service Management - View the full discussion<https://community.servicenow.com/message/1276666?et=watches.email.thread#1276666>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2017 11:28 AM
Hi Juliana,
In my case, the operator has to choose the correct item in order to recategorize. Each of the items has different variables, so I am not sure how you can take incident fields and fill-in the variables, unless you have only one item you recategorize to.
However, I noticed I missed a part of the process when I replied. I also have a BR:
Table: Requested item [sc_req_item]
Name: Data from recategorisatio
When: before insert
Condition: !current.request.parent.nil()
Script:
current.u_recategorized_from = current.request.parent.number;
current.comments = current.variables.description + "\n" + "Task short description: " + current.request.parent.short_description + "\n Task description: " + current.request.parent.description;
current.variables.description = current.variables.description + "\nTask short description: " + current.request.parent.short_description + "\nTask description: " + current.request.parent.description;
current.variables.requested_for = current.request.parent.caller_id; //
Note the last line - this is a variable I have. You can fill out your variables by using current.variables.<VARIABLE_NAME> = current.request.parent.<FIELD_NAME>
De nada,
harel

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2017 11:19 AM
You'd have to redirect them directly to a catalog item to keep the parameter in the url, rather than the catalog home page. That being said, I think the new call plugin does something similar when you create a request from a call, but I can't remember exactly how it does it.