How to modify Copy Change UI action script

attanhes
Tera Guru

I have a requirement to update OTB Copy Change UI action to clear out 'assigned to' fields value on related list task (change_task) level at record creation. So that means when someone copy the change through 'copy change' UI action "assigned to" field should not be copied into change_task level.

I red another post and worked out how to clear out "assigned_to" field on parent change record level but not the change_task. Can someone provide some information?

 

find_real_file.png

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

so you don't want to copy change task "assigned_to" when copy UI action is clicked

there is this system property

1) com.snc.change_request.copy.rl.change_task.attributes -

List of attributes (comma-separated) from Change Task (change_task) related list that will be copied from the originating change

OOB it has values as -> cmdb_ci,priority,assignment_group,assigned_to,short_description,description

remove assigned to from the list and try once

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

5 REPLIES 5

Kunal Varkhede
Tera Guru

Hi,

 

In Copy Change UI action try below script,

 

var gr =new GlideRecord('change_task');

gr.initialise();

gr.field_name = current.fieldName;//copy all the field and stored in new change task

gr.field_name = current.fieldName;//copy all the field and stored in new change task

gr.field_name = current.fieldName;//copy all the field and stored in new change task

gr.assigned_to = ' '; //here dont copy current table assigned To

gr.insert();

 

I hope it will help you

Please Mark Correct/Helpful answer if it help you in any way.

Thanks,

Kunal.

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

so you don't want to copy change task "assigned_to" when copy UI action is clicked

there is this system property

1) com.snc.change_request.copy.rl.change_task.attributes -

List of attributes (comma-separated) from Change Task (change_task) related list that will be copied from the originating change

OOB it has values as -> cmdb_ci,priority,assignment_group,assigned_to,short_description,description

remove assigned to from the list and try once

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Thank you. It worked like magic.

Just one more question to understand this script.

In 'copy change" UI action or 'changeUtils' script include does not call this sys_property (com.snc.change_request.copy.rl.change_task.attributes) at all.

Could you please let me know in which line this property call into this UI scripts?

Hi,

this is the script include -> ChangeUtilsSNC

Copy Change UI Action calls -> ChangeUtils and this calls ChangeUtilsSNC

URL -> https://instanceName.service-now.com/nav_to.do?uri=sys_script_include.do?sys_id=2ddf83eb9fa331002920bde8132e7044

find_real_file.png

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader