- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2024 04:53 AM - edited 05-23-2024 04:55 AM
Hi,
I'm trying to copy all field values from parent complaint case to child complaint case with this display business rule:
if (current.isNewRecord())
current.requesting_service_organization = current.parent.requesting_service_organization;
current.u_agency_worker = current.parent.u_agency_worker;
current.u_agency_worker_name = current.parent.u_agency_worker_name;
current.account = current.parent.account;
current.u_iban_account_number = current.parent.u_iban_account_number;
current.consumer = current.parent.consumer;
However, when I activate the script, all the parent values of the complaint case disappear.
When I deactivate the business rule, the values are back again.
When I create a child complaint case from the parent, it does copy over all the values, despite the values being "empty" in the parent case.
What can I do to fix the "empty" parent case values?
Thanks in advance.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2024 05:09 AM - edited 05-23-2024 05:48 AM
Hi,
I'd move your validation condition to the condition field.
current.isNewRecord() && !current.parent.nil()
(function executeRule(current, previous /*null when async*/) {
var fieldsToCopy = ["consumer","u_iban_account_number","account","u_agency_worker_name","u_agency_worker","requesting_service_organization"]; //Store as a system property
var parentRecordGR = current.getElement('parent').getRefRecord();
fieldsToCopy.forEach(function(field){
current.setValue(field , parentRecordGR.getValue(field));
})
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2024 05:43 AM
Hi @nowitsvashu , yes I corrected that typo but it's still not working. Could you check my edited response above to see if I did anything wrong? Thanks in advance.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2024 05:49 AM
I tested this on incident and it worked fine
(function executeRule(current, previous /*null when async*/) {
var fieldsToCopy = ["caller_id", "assigned_to" , "assignment_group" , "impact" , "urgency"]; //Store as a system property
var parentRecordGR = current.getElement('parent').getRefRecord();
fieldsToCopy.forEach(function(field){
current.setValue(field , parentRecordGR.getValue(field));
})
})(current, previous);