- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2025 01:12 AM
Please help me out in creating a change request from problem but not inserting it. Since the Ui action which creates a change record is saved through it that runs, the mandatory fields not filled in and continue to show as required. It should navigate to sys_is -1.
Below is the code and I have commented out line where it inserts.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2025 04:52 AM
you are not inserting so you won't get the CHG number
so these lines makes no point
var change = new GlideRecord("change_request");
change.short_description = current.short_description;
change.description = current.description;
change.cmdb_ci = current.cmdb_ci;
change.priority = current.priority;
change.company = current.company;
change.sys_domain = current.sys_domain;
change.parent = current.sys_id;
change.type = 'Normal';
//var sysID = change.insert();
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2025 01:44 AM
Hi @Annirnita Dash1,
Please use the below code in your UI action this should redirect your to new change request without inserting the change.
var changeFormUrl = 'https://INSTANCE_NAME.service-now.com/nav_to.do?uri=TABLE_NAME.do?sys_id=-1%26sysparm_query=caller_id='+current.FIELD_NAME; // Construct the URL
action.setReturnURL(current); // Return URL to current record
action.setRedirectURL(changeFormUrl); // Landing page URL to new change form
Please add your instance name and Table name in the URL followed by the mapping.
Hope this information is helpful. If helpful please mark as solution accepted or helpful so that it will help future readers.
Best Regards,
Babu