- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2015 03:39 PM
I'm doing these exercises in my personal developer instance to improve my ServiceNow skills. I'm working on this exercise: "Set up a record producer for the incident table that contains a 'Caller' and 'Configuration item' reference fields the same as your incident form. Automatically populate these fields onto an incident record without using any scripting."
Personal developer instances come with a record producer for incident out of the box, but they don't have those two fields. I created the two fields with the 'Map to field" checkbox checked and with the corresponding field selected. While the Configuration item field works just fine, the Caller field keeps getting overridden by the logged in user once the incident is actually created. There are no catalog UI polices for record producers and only 10 catalog client scripts total, none of which would seem to be causing this. Any advice on what might be going on and how to fix it would be appreciated.
Thanks
Solved! Go to Solution.
- Labels:
-
Personal Developer Instance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-27-2015 01:34 PM
Hey Robert,
There's only a few things that can be acting on the data once it's been submitted. You're going through a Record Producer, so I'd check the Script on the Record Producer (in the "What it will contain" section). By default, the "Create Incident" out-of-box record producer script looks like:
var isMobile = GlideMobileExtensions.getDeviceType() == 'm';
var link = isMobile ? '#/!list/incident/q:active=true%5Ecaller_id=javascript:gs.user_id()%5EEQ' : 'home.do';
var s = 'This incident was opened on your behalf<br/>';
s += 'The IT department will contact you if they need any further information<br/>';
if (isMobile)
s += 'You can track status from this <a href="' + link + '">List</a> <br/>';
else
s += 'You can track status from the <a href="' + link + '">Homepage</a> <br/>';
gs.addInfoMessage(s);
current.contact_type = 'self-service';
current.caller_id = gs.getUserID();
if (producer.comments.length > 80)
current.short_description = producer.comments.substring(0, 79);
else
current.short_description = producer.comments;
Line 13 shows the caller being set to the currently-logged-in user. If you copied this producer's script, and modified it for your needs, you may have missed that line.
After it goes through this script, the only other thing acting on the submitted Incident before it gets saved to the database will be business rules. You can set a Before business rule with a really low order, on Incident, Before insert, which simply logs the caller_id. That will tell you wether the caller_id is getting changed *before* business rules are invoked, or after/during business rule processing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2015 03:54 PM
Hi Robert,
Do you have any Business Rules on Incident or Task which may be setting the caller to the current user?
Try searching for business rules on incident or task, where the script contains caller, where the type is *before* and insert is true, or update is true.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-27-2015 01:11 PM
Hi Cory,
Thanks for replying to almost all of my posts by the way. At any rate, it doesn't appear that a business rule is the issue because the only business rules that operate on the incident table where the script contains caller (that I didn't write myself) is something called "Caller Close". I wasn't sure exactly what the script did but I made the rule inactive and the issue still appears. The other two business rules that satisfy the two constraints are some I created myself that would have no bearing on this but that I made inactive anyway and it still didn't help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2015 05:11 PM
Check the 'Default Value' attribute for the caller_id field using personalize dictionary. If you get something like this "javascript:gs.getUser().getFullName();". Then replace it with the value you want.
Please let me know if you got any queries.
If you find my answer did the job. Please mark it as correct/ helpful answer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-27-2015 01:28 PM
Under default value, the "Use dynamic default" checkbox used to be checked with the dynamic default vale being something called "Incident Get Caller" but the issue persisted even after I unchecked the box. There isn't any default value in the reference field to the user table, and at any rate anytime I've ever tried to use javascript in a reference field like that the system hasn't liked it, but that's another issue.