- 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: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:30 AM - edited 05-23-2024 05:42 AM
Hi @Kieran Anson ,
EDIT:
Thanks for the reply. I've added all the values to a sys property like this:
and adapted the BR script accordingly:
But it's still not copying over the parent values to the child case.
Any ideas?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2024 05:50 AM
In your script you're not fetching the system property, you need to call the following:
var copyValuesProperty = gs.getProperty('coms.copy.values' , '');
var fieldsToCopy = copyValuesProperty.split(',')
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2024 05:40 AM
syntax error
current.setValue(field , parentRecordGR.getValue(field_name));