- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2023 11:01 AM
Hi All,
I have a requirement to populate field values from incident to incident task,
In Incident form i am having (business_service=abc, service_offering=wer, cmdb_ci=cde, short_description=test)
these fields i want to populate on incident task while creating new incident task from incident.
For this requirement I'm using below code it's populated all values except 'service_offering' filed value .
Can any one help me on that how can I auto populate all values
Script Include:
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2023 11:38 AM
@pvv1045330 The script appears to be correct. However, on the incident_task from there is a reference qualifier defined on the Service offering field which only let select those service offering where the parent is value populated on the Business Service field.
In your script, please make sure to populate only those Service offering which are children of Business Service populated on the Service field.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2023 04:51 AM
If there are more than one values then you will have to use List type field rather than a reference type field for Service offering.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2023 12:54 AM
No we can't change the field type, issue is it's populated value on service offering field and got cleared
is there any dictionary override issue?,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2023 09:26 PM
HI @pvv1045330 ,
I trust you are doing great.
Please find the below corrected code for the same
Script INclude:
var YourScriptIncludeName = Class.create();
YourScriptIncludeName.prototype = Object.extendsObject(AbstractAjaxProcessor, {
taskinfo: function(){
var info = this.getParameter('inc_id');
var gr = new GlideRecord("incident");
if (gr.get(info)) {
var ITbs = gr.getValue('business_service');
var ITso = gr.getValue('service_offering');
var ITsd = gr.getValue('short_description');
var response = {};
response.ITbs = ITbs;
response.ITso = ITso;
response.ITsd = ITsd;
return JSON.stringify(response);
}
return null;
},
type: 'YourScriptIncludeName'
});
Client Sxript
var incident_id = g_form.getValue('incident');
if (incident_id) {
var ga = new GlideAjax('YourScriptIncludeName'); // Replace with the actual name of your Script Include
ga.addParam('sysparm_name', "taskinfo");
ga.addParam('inc_id', incident_id);
ga.getXMLAnswer(function(answer) {
var response = JSON.parse(answer);
g_form.setValue('business_service', response.ITbs);
g_form.setValue('service_offering', response.ITso);
// Add any other fields you want to set here
});
}
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2023 10:29 PM
Hi Amit,
No Luck, still I,m getting same issue,
When I comment //g_from.setValue('business_service', response.ITbs);, Then service offering value will be populate but service filed is empty.
I want both filed will be populated .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2024 09:14 PM
Hi @pvv1045330,
Did you get any solution for this ?
Regards,
Pavan.