- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2023 11:36 AM
Hello ,
I am currently working on the "Change" from ITSM . Where I must fill the change request form with value from the Incident after I click on "Create Normal Change" but I cannot get the value of Incident in order to fill the change request form . I am currently working on the client script to solve it but cannot find the value from Incident .
The question I have is how to get the value of Incident record in the related list of change request.
screenshot of the UI action that i use :
example of form that I must fill with the Incident value:
screenshot of the client script :
Code of the script :
function onLoad() {
//Type appropriate comment here, and begin script below
//Verify that the sys_id param is present in URL
var gURL = new GlideURL();
gURL.setFromCurrent();
//var incidentID = gURL.getParam("sys_id");
var incidentID = '2f61e18d87532950fe6162ce8bbb355a';
alert("incidentID : " + incidentID);
alert("get unique value : " + g_form.getUniqueValue());
alert("change_request.incident.number : " + incident.number );
while (gr.next()) {
var sys_id = gr.getValue('sys_id');
alert('sys_id: ' + sys_id);
}
var grcr = new GlideRecord('change_request');
grcr.addQuery('related_link', 'incident.number');
grcr.query();
while (grcr.next()) {
alert('Related link grcr : ' + grcr.sys_id + ' grcr.short_description : ' + grcr.short_description);
}
if (incidentID) {
/**
* Verified this request is a conversion from an Incident
Use the sys_id to create a new GlideRecord Objest with incident Data
*/
var grInc = new GlideRecord('incident');
grInc.get(incidentID);
// Map each of the Incident Fields to the relevant Request fields
/**
* Service -> Service
Service Offering -> Service Offering
Description - > Description
Assignment group ->Assignment group
Assignment to->Assignment to
Urgency -> Urgency
impact -> impact
*/
g_form.setValue('business_service', grInc.business_service);
g_form.setValue('service_offering', grInc.service_offering);
g_form.setValue('u_description_html', grInc.u_description_html);
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2023 07:22 PM
Hi @ericlung ,
Hope you are doing well.
In such requirements I would prefer updating updating UI action - "Create Normal Change" or to create a BR.
As checked in your client script you have user GlideRecord it is not suggested to use that. If you still need to use client script please use GlideAjax
Please mark this response as correct or helpful if it assisted you with your question.
Regards,
Harshal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2023 07:22 PM
Hi @ericlung ,
Hope you are doing well.
In such requirements I would prefer updating updating UI action - "Create Normal Change" or to create a BR.
As checked in your client script you have user GlideRecord it is not suggested to use that. If you still need to use client script please use GlideAjax
Please mark this response as correct or helpful if it assisted you with your question.
Regards,
Harshal