Blog

Copy Fields from Parent Record

When using child records in ServiceNow, you can copy data from the parent record by using a couple of methods.  One method is using filters, which I discussed in this blog post, Ignore_filter_on_new.  

Another method is using a display business rule.  Here are a couple of examples:

Business Rule: Copy Fields From Parent Change

Table: Change Task [change_task]
When: display
insert: true
Advanced: true
Condition: current.isNewRecord() && !current.change_request.nil()
Script:
current.cmdb_ci = current.change_request.cmdb_ci;
current.due_date = current.change_request.due_date;

Business Rule: Copy Fields From Parent Incident

Table: Incident
When: display
Advanced: true
Condition: current.isNewRecord() && !current.parent_incident.nil()
Script:
current.cmdb_ci = current.parent_incident.cmdb_ci;
current.category = current.parent_incident.category;
current.subcategory = current.parent_incident.subcategory;
current.contact_type = current.parent_incident.contact_type;
var comments = current.parent_incident.comments.getJournalEntry(-1);
var cmts = comments.split("(Additional comments)\n"); 
current.comments = cmts[cmts.length-1];

Business Rule: Copy Fields From Parent Problem

Table: Problem Task [problem_task]
When: display
insert: true
Advanced: true
Condition: current.isNewRecord()
Script:
current.cmdb_ci = current.problem.cmdb_ci;
current.due_date = current.problem.due_date;

Business Rule: Copy Fields From Parent Project

Table: Project Task [pm_project_task]
When: display
insert: true
Advanced: true
Condition: current.isNewRecord()
Script:
current.assignment_group = current.top_task.assignment_group;

Another article to read: Managing Child Tasks in ServiceNow