- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-10-2017 05:59 AM
Hi,
How do I ensure that when you open and create a new Incident Task from an Incident ticket, that it inherits the priority from the Incident ticket?
Many thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2017 02:19 AM
Couldn't you just dot-walk from the task to the incident... then obtain the priority from there?
Just thinking that it's a read-only value and won't change throughout related records, so makes sense to keep it in one location and display it in several, rather than copy it throughout different records (then factor in cascade updates if the incident priority changes)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2017 02:24 AM
Hi Dave,
Thanks for taking the time to reply
How would I do the dot-walk?
Kind regards
Clive
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2017 02:59 AM
Hi Dave,
Sorry just remembered what dot-walking is, and that's a great idea and does in fact do the job and what I require, thank you so much
Many thanks
Clive
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-10-2017 06:03 AM
An insert BR on Incident Task table, with action as: current.priority = current.parent.priority;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-10-2017 04:08 PM
Hey Clive,
Anurag is correct in that you need to set the script as "current.priority = current.parent.priority;", but you also need to make sure that the parent field is filled out before submitting your new incident_task record. You can either make that field 'mandatory' or create a UI policy/client script (kind of overkill for this use case) to prevent a user from submitting the form without filling out the parent field. Here's a quick way to set the field to mandatory:
Parent is the correct name of the reference field that links your incident_task record to your incident record. A quick way to find out the field name is by right clicking the field on the form and seeing the value as shown below:
On that same picture you can click 'Configure Dictionary' to view the dictionary definition of that field and set the mandatory flag to true.
A little more breakdown on what "current.parent.priority" does:
current - your current record (in this case it is your incident_task record that you are about to create)
parent - the field on your incident_task form that references the incident record
priority - the field in your incident form that contains the priority value you are trying to copy
That powerful ability to instantly access a referenced record's field in the code is called 'dot walking'. Here's a helpful doc for that: Dot-Walking - ServiceNow Wiki
Also make sure that your business rule runs before insert so that your priority field from Incident gets copied over before the record is inserted into the database.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2017 01:44 AM