- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2025 05:55 AM
Hello, good day/eve)
I am trying to create a UI Action script so that I can copy a change.
Instance details: Developer instance. Xanadu.
UI Action is as follows:
UI Action script:
var gr = new GlideRecord("change_request");
gr.initialize();
gr.requested_by = current.requested_by;
gr.short_description = current.short_description;
gr.description = current.description;
gr.priority = current.priority;
gr.risk = current.risk;
gr.impact = current.impact;
gr.type = current.type;
gr.category = current.category;
gr.state = -5; // New
gr.assignment_group = current.assignment_group;
gr.assigned_to = current.assigned_to;
var grSysId = gr.insert(); // I think this is the code which inserts the record into the database.
action.setRedirectURL("/change_request?sys_id=" + grSysId);
This UI Action shows in change_request form as follows:
So, the query is, when I am clicking "Copy Change", the change is being duplicated but the change is also getting submitted.
I want it just to direct us to the duplicated change ticket but not submit it automatically, but only when user clicks "Submit".
Thank you for your consideration and looking into this. 🍀
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2025 10:19 AM
Hi @nemis,
You're trying to create a UI action that duplicates a Change Request but doesn’t submit it automatically, allowing the user to review the new record before submitting it. You can use the out-of-the-box "Copy Change" UI actions available for both Native UI and Workspace.
Native UI: https://<instance_name>.service-now.com/sys_ui_action.do?sys_id=eb0f43eb9fa331002920bde8132e7072&sysparm_view=&sysparm_record_target=sys_ui_action&sysparm_record_row=1&sysparm_record_list=nameCONTAINScopy%5Etable%3Dchange_request%5EORDERBYorder&sysparm_record_rows=2
Workspace: https://<instance_name>.service-now.com/sys_ui_action.do?sys_id=d1cd48a143431110101939aaaab8f241&sysparm_view=&sysparm_record_target=sys_ui_action&sysparm_record_row=2&sysparm_record_list=nameCONTAINScopy%5Etable%3Dchange_request%5EORDERBYorder&sysparm_record_rows=2
Please mark this answer as Helpful if this solution works for you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2025 10:19 AM
Hi @nemis,
You're trying to create a UI action that duplicates a Change Request but doesn’t submit it automatically, allowing the user to review the new record before submitting it. You can use the out-of-the-box "Copy Change" UI actions available for both Native UI and Workspace.
Native UI: https://<instance_name>.service-now.com/sys_ui_action.do?sys_id=eb0f43eb9fa331002920bde8132e7072&sysparm_view=&sysparm_record_target=sys_ui_action&sysparm_record_row=1&sysparm_record_list=nameCONTAINScopy%5Etable%3Dchange_request%5EORDERBYorder&sysparm_record_rows=2
Workspace: https://<instance_name>.service-now.com/sys_ui_action.do?sys_id=d1cd48a143431110101939aaaab8f241&sysparm_view=&sysparm_record_target=sys_ui_action&sysparm_record_row=2&sysparm_record_list=nameCONTAINScopy%5Etable%3Dchange_request%5EORDERBYorder&sysparm_record_rows=2
Please mark this answer as Helpful if this solution works for you.