From 1b5b6b371fd8ec9aaece53d20d0201c28799fcd6 Mon Sep 17 00:00:00 2001 From: mits <104266846+mitalizope@users.noreply.github.com> Date: Tue, 7 Oct 2025 02:03:07 +0530 Subject: [PATCH 1/4] Create IncidentToProblemMapping.js This file includes a client script that maps the values from parent incident record fields to the problem record fields. --- .../IncidentToProblemMapping.js | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Client-Side Components/Client Scripts/Incident to Problem Field Mapper/IncidentToProblemMapping.js diff --git a/Client-Side Components/Client Scripts/Incident to Problem Field Mapper/IncidentToProblemMapping.js b/Client-Side Components/Client Scripts/Incident to Problem Field Mapper/IncidentToProblemMapping.js new file mode 100644 index 0000000000..79de15f9ab --- /dev/null +++ b/Client-Side Components/Client Scripts/Incident to Problem Field Mapper/IncidentToProblemMapping.js @@ -0,0 +1,21 @@ +//Client script to map the fields in problem +function onChange(control, oldValue, newValue, isLoading, isTemplate) { + + if (newValue === '') { + return; + } + + var ga = new GlideAjax('IncidentDetails'); + ga.addParam('sysparm_name', 'getIncidentDetails'); + ga.addParam('sysparm_incidentSysId', newValue); + ga.getXMLAnswer(function(response) { + var result = JSON.parse(response); + + g_form.setValue('cmdb_ci', result.cmdb_ci); + g_form.setValue('priority', result.priority); + g_form.setValue('assignment_group', result.assignment_group); + g_form.setValue('short_description', result.short_description); + g_form.setValue('description', result.description); + }); + +} From fdd93af071f322c0485ecd7d39f728a1ceb45314 Mon Sep 17 00:00:00 2001 From: mits <104266846+mitalizope@users.noreply.github.com> Date: Tue, 7 Oct 2025 02:05:47 +0530 Subject: [PATCH 2/4] Create IncidentDetails.js This file contains a script include to get the values of incident record fields. --- .../IncidentDetails.js | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Client-Side Components/Client Scripts/Incident to Problem Field Mapper/IncidentDetails.js diff --git a/Client-Side Components/Client Scripts/Incident to Problem Field Mapper/IncidentDetails.js b/Client-Side Components/Client Scripts/Incident to Problem Field Mapper/IncidentDetails.js new file mode 100644 index 0000000000..3e64220ebe --- /dev/null +++ b/Client-Side Components/Client Scripts/Incident to Problem Field Mapper/IncidentDetails.js @@ -0,0 +1,22 @@ +//Script include to get the values of incident record fields +var IncidentDetails = Class.create(); +IncidentDetails.prototype = Object.extendsObject(AbstractAjaxProcessor, { + + getIncidentDetails: function() { + var inc = this.getParameter('sysparm_incidentSysId'); + var result = {}; + + var gr = new GlideRecord('incident'); + if (gr.get(inc)) { + result.cmdb_ci = gr.cmdb_ci.toString(); + result.priority = gr.priority.toString(); + result.assignment_group = gr.assignment_group.toString(); + result.short_description = gr.short_description.toString(); + result.description = gr.description.toString(); + } + + return JSON.stringify(result); + }, + + type: 'IncidentDetails' +}); From f030c78451f12f860764f90188bceaa978d742a0 Mon Sep 17 00:00:00 2001 From: mits <104266846+mitalizope@users.noreply.github.com> Date: Tue, 7 Oct 2025 02:08:48 +0530 Subject: [PATCH 3/4] Create README.md --- .../README.md | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Client-Side Components/Client Scripts/Incident to Problem Field Mapper/README.md diff --git a/Client-Side Components/Client Scripts/Incident to Problem Field Mapper/README.md b/Client-Side Components/Client Scripts/Incident to Problem Field Mapper/README.md new file mode 100644 index 0000000000..b9d94b99b9 --- /dev/null +++ b/Client-Side Components/Client Scripts/Incident to Problem Field Mapper/README.md @@ -0,0 +1,23 @@ +**Maps Incident Fields to Child Problem** + +**Description:** +This client script automatically maps key field values from a parent Incident record to a Problem record when the user creates a new Problem and selects an Incident record in the Parent reference field. + +**Client Script:** +Name: IncidentToProblemMapping +Table: Problem [problem] +Type: onChange +Field name: Parent + +**Script Include:** +Name: IncidentDetails +Glide AJAX enabled: checked + +**Implementation:** +Place this script on the Problem table with the condition that it triggers on change of the Parent field. When the selected parent record is from the Incident table, it fetches field values from the Incident using GlideAjax and sets them on the Problem form. +Fields Mapped: +• Configuration Item +• Priority +• Assignment Group +• Short Description +• Description From fbee415eaef3d2951846a93adba05bb092e751ea Mon Sep 17 00:00:00 2001 From: mits <104266846+mitalizope@users.noreply.github.com> Date: Tue, 7 Oct 2025 02:15:27 +0530 Subject: [PATCH 4/4] Update README.md --- .../Client Scripts/Incident to Problem Field Mapper/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Client-Side Components/Client Scripts/Incident to Problem Field Mapper/README.md b/Client-Side Components/Client Scripts/Incident to Problem Field Mapper/README.md index b9d94b99b9..311f339b07 100644 --- a/Client-Side Components/Client Scripts/Incident to Problem Field Mapper/README.md +++ b/Client-Side Components/Client Scripts/Incident to Problem Field Mapper/README.md @@ -15,6 +15,7 @@ Glide AJAX enabled: checked **Implementation:** Place this script on the Problem table with the condition that it triggers on change of the Parent field. When the selected parent record is from the Incident table, it fetches field values from the Incident using GlideAjax and sets them on the Problem form. + Fields Mapped: • Configuration Item • Priority