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.

Using javascript to set up the default value of a field as the same as the value of that field in the parent task

sonofliber1
Tera Contributor

Hi, i want the default value of a field in a child task to be the same as the current value of that field in the parent task(so for example, in a change task for the field business_services, i want the default to be the parent ticket value of that field (in this case it would be the business_services field in the change request form)

Searching around it looks like it should be like this:

javascript:current.parent.business_service.getDisplayValue();

but its not working.

 

I have done it with client scripts sucessfully, but i want to try it with default value now.

5 REPLIES 5

You can try with Display BR with onLoad() client script if provided suggestion doesn't work.

Display BR on change_task table

var gr = new GlideRecord('change_request');
gr.get(current.change_request);
g_scratchpad.business_service = gr.business_service;

onLoad() client script on change_task table.

g_form.setValue('business_service', g_scratchpad.business_service);