Dot Walk Mapping on Record Producer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2015 02:41 PM
I've been mapping over fields from a record producer to the corresponding fields on the record with the script field on the record producer: current.record_field = producer.variable_name. The question I have is, is it possible to dot walk to a related table like 'Location' or 'User' from the Requested Item table and have a variable map to one of those? Like current.location.record_field = producer.variable_name.So far I haven't been successful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2015 05:18 PM
Hi Lindsey,
"current" in this context should be a GlideRecord, and so dot-walking should be feasible. There are a couple of things to check.
- Are you setting current.location before trying to dot-walk?
- If so, are you using setValue, or direct assignment (current.location = value) ?
- If you are using direct assignment, try using setValue("location",new_value) instead, so you don't overwrite the GlideElement for that field with a string.
- If you still can't dotwalk after using setValue, try fetching the related record with getRefRecord
var loc = current.location.getRefRecord();
loc.record_field = producer.variable_name;
loc.update();
If none of those work, try checking the Script Logs on your instance- is there any relevant information there which could be helpful in diagnosing this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2015 06:06 PM
Hi Lindsey, you may want to give it a try to loc.updateWithReferences()
Inserting/Updating GlideRecord with References - ServiceNow Wiki
Thanks,
Berny