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

Steven Chaparro
ServiceNow Employee
ServiceNow Employee

Ok will do, but I will like to add that in the instance it is creating a problem with all the fields without any issue, is the simulator task that is not being validated. 

here is the UI action on my instance, and I added the field that needed to be copied but still the task failed.

I will let you know the result from the background script but I expect the script include to be working with no issue.

Steven Chaparro
ServiceNow Employee
ServiceNow Employee

Interesting, the background script didn’t worked, but the UI action is working. here’s a screenshot with all the fields being copied from the incident:

Chavan AP
Tera Guru

Hi There please below script in before BR on incident table:

 

- Configuration item
- Priority
- Assignment group
- Short Description
- Description



(function executeRule(current, previous /*null when async*/) {

        var newPRB = new GlideRecord('problem');
   
        newPRB.cmdb_ci = current.cmdb_ci;
        newPRB.location = current.location;
        newPRB.short_description = 'PRB raised' + current.number + ' - Auto Generated';
        newPRB.description = 'PRB raised  ' + current.number + '\nIncident description: ' + current.description;
        newPRB.assignment_group = current.assignment_group; 
        newPRB.insert();

current.problem_id = newPRB.sys_id;

})(current, previous);

 

 

Mark it correct answer if this resolves your query!!

Regards

AJay

Glad I could help! If this solved your issue, please mark it as ✅ Helpful and ✅ Accept as Solution so others can benefit too.*****Chavan A.P. | Technical Architect | Certified Professional*****

Steven Chaparro
ServiceNow Employee
ServiceNow Employee

Thank you all for your suggestions, but I am more interested to know what is the best practice. So far only one has stated was is the best practice for the simulator and was the same thing I did, so probably the simulator has an issue and is not recognizing my task to validate. 
Just to clarify, adding the fields to the property is working. I just want to know what is the best practice if what I did is not. Thank you all again!

ootb one is the best practice. follow the property one which you are already following. i would never suggest to make any changes on the OOTB ui action script.