- 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 08:10 AM
So did you make the change that Adam suggested and it worked? Are you using all oob fields or is there a custom field in use? We use multilanguage as well but no matter what I do I can't get undefined error.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2014 11:14 PM
out of the box button seems to work just fine.... can you paste a screenshot?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2014 07:36 AM
Hi Kalaiarasan,
As you suggested, I replied to Micheal and included a few screenshots. Let me know if it helps undestanding the problem. Thanks!
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2014 01:20 AM
I can only imagine that this would happen if there have been no entries added into the work_around Journal field. Try replacing "getJournalEntry(1)" with "getJournalEntry(-1)" as it'll pull over all entries, just as a test.
As you are getting text entered into your Incidents I doubt that this is a problem with the state choices. Maybe you could replace "incident.comments = (num + ' ' + current.work_around.getJournalEntry(1));" with something like:
incident.comments = ("abc");
Agan just to test, or you could try using a different field:
incident.comments = (num + ' ' + current.short_description);
If both of these work then it'll definitely be an issue with that field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2014 07:38 AM
Hi Adam,
I'll try what you suggested and keep you posted. I'm just wanderring how come I have to change an OOB script. I guess it's something we changed elsewhere.
Steve