- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2025 03:08 AM
I have been trying to set up a Business Rule so when I create a Incindent Task from an incident it will copy desired fields to the task. Been using this Solved: copy fields from incident to incident task - ServiceNow Community . But apparently I cant seem to get it to work. Is there something I am missing? Have attached my Business rule. Hopefully someone can see what I am missing.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2025 03:20 AM
Hi @Klaus Schacht ,
Thanks for marking my response as helpful
if your issue is resolve could you please accept it as a solution and close the thread.
if you want to populate the info before submission( onload of the form) you can create a onload client script and client callable script include
Script include
script
var IncidentDetails = Class.create();
IncidentDetails.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getIncidentDetails: function() {
var incidentSysId = this.getParameter('sysparm_incidentSysId');
var result = {};
if (!incidentSysId) {
return JSON.stringify(result);
}
var incident = new GlideRecord('incident');
if (incident.get(incidentSysId)) {
result.short_description = incident.getValue('short_description');
result.assignment_group = incident.getValue('assignment_group');
}
return JSON.stringify(result);
},
type: 'IncidentDetails'
});
onLoad client script
script
function onLoad() {
var incidentSysid = g_form.getValue('incident');
if (g_form.isNewRecord() && incidentSysid) {
var ga = new GlideAjax('IncidentDetails');
ga.addParam('sysparm_name', 'getIncidentDetails');
ga.addParam('sysparm_incidentSysId', incidentSysid);
ga.getXMLAnswer(function(response) {
var data = JSON.parse(response);
g_form.setValue('short_description', data.short_description);
g_form.setValue('assignment_group', data.assignment_group);
});
}
}
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2025 02:47 AM
Aparently it doesn't populate the fields from incident before pressing submit on the task, eventhough "Before" is chosen. I was expecting it to populate the desired fields upon creation of the task. This is a Nice To Have feature but for now this procedure is acceptable. Thanks for all your replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2025 03:20 AM
Hi @Klaus Schacht ,
Thanks for marking my response as helpful
if your issue is resolve could you please accept it as a solution and close the thread.
if you want to populate the info before submission( onload of the form) you can create a onload client script and client callable script include
Script include
script
var IncidentDetails = Class.create();
IncidentDetails.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getIncidentDetails: function() {
var incidentSysId = this.getParameter('sysparm_incidentSysId');
var result = {};
if (!incidentSysId) {
return JSON.stringify(result);
}
var incident = new GlideRecord('incident');
if (incident.get(incidentSysId)) {
result.short_description = incident.getValue('short_description');
result.assignment_group = incident.getValue('assignment_group');
}
return JSON.stringify(result);
},
type: 'IncidentDetails'
});
onLoad client script
script
function onLoad() {
var incidentSysid = g_form.getValue('incident');
if (g_form.isNewRecord() && incidentSysid) {
var ga = new GlideAjax('IncidentDetails');
ga.addParam('sysparm_name', 'getIncidentDetails');
ga.addParam('sysparm_incidentSysId', incidentSysid);
ga.getXMLAnswer(function(response) {
var data = JSON.parse(response);
g_form.setValue('short_description', data.short_description);
g_form.setValue('assignment_group', data.assignment_group);
});
}
}
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-28-2025 03:23 AM
Thanks I will definetly try it out 😉