Create a Problem from Incident UI action issue copying INC assignment group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2019 12:10 PM
I am unable to get my NOW Learning task to complete successfully.
I need to create a new problem from an incident with all necessary information. The 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.
The OOTB has all configured except the assignment group. I've tried modifying the Script for the Create Problem (incident table) UI Action. I added a line:
prob.assignment_group == current.assignment_group;
this gives me an error "Expected an assignment or function call and instead saw an expression. I understand the error message, but don't know what I needed to do to get the correct answer to solving this task.
Please instruct me on what the correct answer is and why so I can understand and learn.
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2019 11:31 AM
Try this
prob.assignment_group = current.assignment_group;
Please mark my response as correct and helpful if it helped solved your question.
-Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2019 11:40 AM
where do I add this at (before/after which line)?
do I only add what you suggested and that's it or do I need to add any other lines?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2019 11:46 AM
Try this
getProblemFromIncident: function(current) {
if(!current.isValidRecord())
return undefined;
var fieldsToBeCopiedFromIncident = [];
var prob = new GlideRecord("problem");
var record = new GlideRecord('sys_properties');
record.addQuery('name', 'com.snc.problem.create_from_incident.attributes');
record.query();
if(record.next())
fieldsToBeCopiedFromIncident = this.getCsvValue(record.value);
for(var i = 0; i < fieldsToBeCopiedFromIncident.length; i++) {
if(fieldsToBeCopiedFromIncident[i] === 'number' && prob.isValidField("first_reported_by_task"))
prob.first_reported_by_task = current.getUniqueValue();
else if (fieldsToBeCopiedFromIncident[i] === 'category') {
var elCategory = prob.getElement("category");
var choicesCategory = elCategory.getChoices();
if ( choicesCategory && choicesCategory.indexOf(current.category) >= 0 )
prob.category = current.category;
} else if (fieldsToBeCopiedFromIncident[i] === 'subcategory') {
var elSubcategory = prob.getElement("subcategory");
var choicesSubcategory = elSubcategory.getChoices(current.category);
if ( choicesSubcategory && choicesSubcategory.indexOf(current.subcategory) >=0 )
prob.subcategory = current.subcategory;
} else if (prob.isValidField(fieldsToBeCopiedFromIncident[i])) {
prob[fieldsToBeCopiedFromIncident[i]] = current[fieldsToBeCopiedFromIncident[i]];
} else {
gs.addErrorMessage(gs.getMessage("{0} is not a valid field in Problem", fieldsToBeCopiedFromIncident[i]));
return undefined;
}
prob.assignment_group = current.assignment_group;
}
return prob;
},
Please mark my response as correct and helpful if it helped solved your question.
-Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2019 12:04 PM
I am not able to make the change in the Script Include...system is telling me "The item is read-only based on its protection policy"
I can't tell if this is because of needing elevated privileges or not? If so, I can't figure out how to get that to work either because I have several other tasks that I can't figure out because of that too.
I'm trying to resolve a few incomplete tasks from the NOW Learning simulator a day since I've made my attempts and have only been able to complete or partially complete 85% of the simulator.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2020 08:10 PM
just insert required field values(assignment_group,priority,description,short_description,cmdb_ci) in "com.snc.problem.create_from_incident.attributes" system properties list..