- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2014 08:44 AM
Anybody knows why the link Communicate Workaround in a problem, which is a UI Action that comes Out Of the Box (OOB), returns an "Undefined Value" in the incidents related to this problem instead of populating with the WorkAround field content?
According to my undestanding, I should replace current.work_around.getJournalEntry(1) with a variable defined earlier, like num and incident that are defined. But before I modify it, since it's a OOB Script, maybe there's something I'm missing. Thanks for your input.
Here the content of the OOB script of the UI Action:
current.update();
workaround();
function workaround(){
var num = current.number;
var incident = new GlideRecord("incident");
incident.addQuery("problem_id", "=", current.sys_id);
incident.addQuery("incident_state", "<", 6);
incident.query();
while (incident.next()) {
incident.comments = (num + ' ' + current.work_around.getJournalEntry(1));
incident.update();
}
gs.addInfoMessage('Workaround communicated');
action.setRedirectURL(current);
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2014 05:04 AM
OK, with your help, I finally found the solution. I post it here so it may be used by someone facing a similar issue.
The reason why the script is not working in our environnement and returns a value of "undefined" is because the field work_around has been changed when we installed the Problem Management a few months ago. It's type has been changed for "STRING" instead of the default type of "JOURNAL INPUT". By doing so, the UI Action "Communicate Workaround" doesn't work because of the following line which tries to copy a journal entry:
incident.comments = ( num + ' ' + current.work_around.getJournalEntry(1));
To fix our problem, I either have to put the field type back to journal input or replace the line by this one:
incident.comments = (num + ' ' + current.work_around);
Since the field type has been change to allow the work_around to remain present in the field instead of being removed and copied in the activity logs, I'll change the script to refer to the value of current.work_around and not its journal entry.
Special thanks to Michael, Kalaiarasan and Adam who each gived me a part of the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2014 03:05 PM
It's precisely the part that doesn't work: either current.work_around.getJournalEntry(1) or current.work_around.getJournalEntry(-1) return the "undefined" message.
I confirm that the work_around field is active and there's a value in it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2014 05:04 AM
OK, with your help, I finally found the solution. I post it here so it may be used by someone facing a similar issue.
The reason why the script is not working in our environnement and returns a value of "undefined" is because the field work_around has been changed when we installed the Problem Management a few months ago. It's type has been changed for "STRING" instead of the default type of "JOURNAL INPUT". By doing so, the UI Action "Communicate Workaround" doesn't work because of the following line which tries to copy a journal entry:
incident.comments = ( num + ' ' + current.work_around.getJournalEntry(1));
To fix our problem, I either have to put the field type back to journal input or replace the line by this one:
incident.comments = (num + ' ' + current.work_around);
Since the field type has been change to allow the work_around to remain present in the field instead of being removed and copied in the activity logs, I'll change the script to refer to the value of current.work_around and not its journal entry.
Special thanks to Michael, Kalaiarasan and Adam who each gived me a part of the solution.