Make Parent field required when child task is created.

dagarson
Tera Guru

Hello I am trying to create a ui policy on the hr_task table with the requirement that when the task is created a parent case field becomes mandatory so you cannot close the task until the parent field is filled. 

the ui policy dot walks to the field from the parent field on the hr task record find_real_file.png

And this is the script I am trying to run

find_real_file.png

The conditions to run are just based on some information from the task being populated.

I am getting the field message on the task but the parent tracking number is not being made mandatory and the task can be closed.

Any assistance would be greatly appreciated. 

1 ACCEPTED SOLUTION

Mohit Kaushik
Mega Sage
Mega Sage

Hi There,

You need to correct your code, tracking is no field in your table, so you can achieve this in two ways:

1. Scripting:

g_form.setMandatory('parent.u_tracking_numner',true); //Please mention the correct field name here.

2. Without scripting:

Just create a UI policy action and you should be able to achieve this functionality.

 

Please mark this as correct and helpful if it resolved the query or lead you in right direction.

Thanks,
Mohit Kaushik
Community Rising Star 2022

Thanks,
Mohit Kaushik
ServiceNow MVP (2023-2025)

View solution in original post

1 REPLY 1

Mohit Kaushik
Mega Sage
Mega Sage

Hi There,

You need to correct your code, tracking is no field in your table, so you can achieve this in two ways:

1. Scripting:

g_form.setMandatory('parent.u_tracking_numner',true); //Please mention the correct field name here.

2. Without scripting:

Just create a UI policy action and you should be able to achieve this functionality.

 

Please mark this as correct and helpful if it resolved the query or lead you in right direction.

Thanks,
Mohit Kaushik
Community Rising Star 2022

Thanks,
Mohit Kaushik
ServiceNow MVP (2023-2025)