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

Mark Stanger
Giga Sage

You might try this...

javascript:current.parent.business_service;

If you're setting a reference field you want to use the sys_id, not the display value.  If you're still having problems, it's likely because 'current.parent' may not exist before the record is created.

Hi, i try that but to no avail

try

javascript:current.change_request.business_service;


Please mark this response as correct or helpful if it assisted you with your question.

Also this should be added as a default to a dictionary override record, so that it doesn't impact other tables


Please mark this response as correct or helpful if it assisted you with your question.