Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Modify the New UI Action on Related List to Pull Parent Value into Child Task

richelle_pivec
Mega Guru

I would like to modify the Out of the Box UI Action for New on a related Child Task List. In this case it is a Demand Task table that I have extended off of the Demand Table. The "New" UI Action I enabled from the List Control was the Default New. I have since created one for the u_demand_task table so that I am only updating that "New" UI Action on this related list.

My ultimate objective is that every time I use the New button the Short Description from the Parent populates the Short Description on the Child Task. Perhaps there is a better way to do this rather than modifying the UI Action? One option I thought of was a Dictionary override on the Short Description field on the Child Task for the Short Description field, but I have no idea what code to put in there.

Any thoughts on how I can easily make this the default value? I don't want it to "stick," so I can't use an on-load business rule that would always over-ride whatever someone wrote in there. I just want it to be their starting point.

Thanks,

Richelle

1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

I recommend doing this WITHOUT any code using a display business rule. See the images below on how I did this with the incident task table to pull the short description from the parent incident.

No code solutions are easier to build and maintain. When given a choice between a coded solution and non-code, take the non-code every time. 🙂

The trick is to use the Advanced checkbox.

Set When to Display

Condition: Short description | is | empty

Set your fields values to: Short description | same as | Incident.short description

find_real_file.png

 

find_real_file.png

View solution in original post

5 REPLIES 5

Daniele Songini
Tera Guru

Hi Richelle,

Only the field which refers to the parent table will be auto-populated.
if you want to populate some other field then some manipulation has to be done.

One thing you can do is have onLoad client script and since you already have a reference field to parent, using g_form.getReference() with callback you can auto-populate that.

if you use br and client scripts, make sure that they are executed only if you are creating a new record with the function isNewRecord().

Please mark this as "Correct Answer" if I have given you a sufficient answer to your question.

Best Regards,
Daniele

Chuck Tomasi
Tera Patron

I recommend doing this WITHOUT any code using a display business rule. See the images below on how I did this with the incident task table to pull the short description from the parent incident.

No code solutions are easier to build and maintain. When given a choice between a coded solution and non-code, take the non-code every time. 🙂

The trick is to use the Advanced checkbox.

Set When to Display

Condition: Short description | is | empty

Set your fields values to: Short description | same as | Incident.short description

find_real_file.png

 

find_real_file.png

Hi Chuck,

I did the same for change task records on the below screenshot it shows empty but when i open the records it shows the value How to fix this so that it displays here too

DivyaRajasekar_0-1695113649974.png

 

richelle_pivec
Mega Guru

Thanks Chuck,

That worked like a charm,

Richelle