Incident task priority to be inherited from the incident

clivebushell
Giga Contributor

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

1 ACCEPTED SOLUTION

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)


View solution in original post

22 REPLIES 22

Hi Dave,



Thanks for taking the time to reply



How would I do the dot-walk?



Kind regards



Clive


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


anurag92
Kilo Sage

An insert BR on Incident Task table, with action as: current.priority = current.parent.priority;


johnolivermendo
ServiceNow Employee
ServiceNow Employee

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:


Screen Shot 2017-04-10 at 3.40.02 PM.JPG


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.


Hi John Oliver



Many thanks for your reply



Sadly the Incident task is still not picking up the Incidents priority



I can confirm that the priority field on the Incident ticket is mandatory, it runs off the impact and Urgency matrix.



find_real_file.png



Any other ideas?



Many thanks



Clive