- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2023 07:48 AM
The Ui action Create child incident which is out of box stuff provided by servicenow is creating a new incident and also copies data from parent incident but it does not link the new incident created to the parent incident. Has anyone seens this too in their environment.
sys id of ui action sys_id=117f90e367cb3200060071bfa2415a51 (create child incident)
The UI action (/sys_ui_action.do?sys_id=117f90e367cb3200060071bfa2415a51) calls the following:
NOW._createChildIncident(g_form.getUniqueValue());
This function is stored in an onLoad client script
CreateChildIncident (/sys_script_client.do?sys_id=10d1fe0a531332000600e26b88dc34ee)
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2023 09:26 PM
If the UI action "Create child incident" is not linking the new incident created to the parent incident, it may be necessary to modify the script to include the linking of the new incident to the parent incident. You can create a new UI Action by copying the existing UI Action and modifying it to include linking the new incident to the parent incident.
To do this, you can modify the NOW._createChildIncident function to include code to link the new incident to the parent incident. You can use the addQuery method on a GlideRecord object to link the new incident to the parent incident. For example, you can use the following code:
var parentIncidentID = g_form.getUniqueValue();
var newIncident = new GlideRecord('incident');
newIncident.initialize();
newIncident.setValue('short_description', 'New Child Incident');
newIncident.setValue('parent', parentIncidentID);
newIncident.insert();
This code initializes a new incident record, sets the short description, and links it to the parent incident using the parent field. Once this code is added to the script, the new incident created using the modified UI action will be linked to the parent incident.
Please mark my answer as a solution/helpful in case it adds value and moves you a step closer to your desired ServiceNow solution goal.
Thanks,
Punit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2023 09:26 PM
If the UI action "Create child incident" is not linking the new incident created to the parent incident, it may be necessary to modify the script to include the linking of the new incident to the parent incident. You can create a new UI Action by copying the existing UI Action and modifying it to include linking the new incident to the parent incident.
To do this, you can modify the NOW._createChildIncident function to include code to link the new incident to the parent incident. You can use the addQuery method on a GlideRecord object to link the new incident to the parent incident. For example, you can use the following code:
var parentIncidentID = g_form.getUniqueValue();
var newIncident = new GlideRecord('incident');
newIncident.initialize();
newIncident.setValue('short_description', 'New Child Incident');
newIncident.setValue('parent', parentIncidentID);
newIncident.insert();
This code initializes a new incident record, sets the short description, and links it to the parent incident using the parent field. Once this code is added to the script, the new incident created using the modified UI action will be linked to the parent incident.
Please mark my answer as a solution/helpful in case it adds value and moves you a step closer to your desired ServiceNow solution goal.
Thanks,
Punit