Creating Problem from an Incident

Steven Chaparro
ServiceNow Employee
ServiceNow Employee

Hello All,

Im trying to complete the ITSM (Madrid) Simulator but now I am not sure if the simulator has some issues or I don't know what are the best practices.
One of the task is creating a Problem from an Incident. The instructions are the following:

We want to be able to create a new problem from an incident with all necessary information.
1. Following fields should be copied from an incident when a new problem is created from an incident.
- Configuration item
- Priority
- Assignment group
- Short Description
- Description

2. Impersonate itil.<your first name> and click to create a new problem from an incident. Following fields should be copied from an incident:
- Configuration item
- Priority
- Assignment group
- Short Description
- Description

A quick search in the servicenow documentation I found this: Create a problem | ServiceNow Docs
With the following note in the procedure to create a problem from an incident:
Note: Use the property List of attributes (comma-separated) that will be copied from the incident to create a new problem (com.snc.problem.create_from_incident.attributes) to specify fields on the Incident form. The values of these fields are copied to the respective fields on the Problem form.

A screenshot where I added the fields required...
find_real_file.png

 

So I did that, and still the task failed, with the following recommendation:
"Please validate fields are copied from Incident to Problem using best practices."

What I am missing here?

1 ACCEPTED SOLUTION

Adding the field inside the property is an best approach for simulator !!

 

If you hard code a script it in the UI action then the task will fail

 

Please mark the answer as correct or helpful, if it helped you !!!

 

 

Regards,

Chalan

View solution in original post

16 REPLIES 16

Vishal Khandve
Kilo Sage

there is a OOTB UI action available in the servicenow.

if not the you can create the new UI action like below-

 

name: create problem

form context menu: true

condition: current.incident_state != IncidentState.CLOSED && gs.hasRole("itil")  && current.problem_id.nil()

script: 

var prob = new GlideRecord("problem");
prob.short_description = current.short_description;
prob.cmdb_ci = current.cmdb_ci;
prob.impact = current.impact;
prob.urgency = current.urgency;
prob.priority = current.priority;
prob.company = current.company;
prob.sys_domain = current.sys_domain;
var sysID = prob.insert();

current.problem_id = sysID;
var mySysID = current.update();
gs.addInfoMessage(gs.getMessage("Problem {0} created", prob.number));
action.setRedirectURL(prob);
action.setReturnURL(current);

 

 

Thank you,

Vishal Khandve

Steven Chaparro
ServiceNow Employee
ServiceNow Employee
I saw that UI action but following the documentation I didn’t think it was a best practice to modify the script that is calling anyways the script include that look for the system property. But still my question remains, is changing the script inside of the ui action the best practice? Or is adding the value to the property the best practice?

make the OOTB UI action false and create new one with your requirement.

 

 

Thanks,

Vishal Khandve

Adding the field inside the property is an best approach for simulator !!

 

If you hard code a script it in the UI action then the task will fail

 

Please mark the answer as correct or helpful, if it helped you !!!

 

 

Regards,

Chalan