- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2017 08:59 AM
I have Parent to Child Relationships for some of the Records in the Locations table. How do I fill in (and make read only) the values on the Children based on the parent Record. eg. All children locations have the same company as the parent location and only the Parent can be changed
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2017 09:04 AM
Hi Stephen,
Please add a onAfter - Update Businessrule with below script
Condition - Parent is Empty
var loc = new GlideRecord('cmn_location');
loc.addQuery('parent',current.sys_id);
loc.query();
while (loc.next())
{
loc.company = current.company;
loc.update();
}
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2017 09:01 AM
I'd add a Business rule to your location table - when a field you want inherited is updated, do a glide record query to find all children of the parent and update that field. Then add a UI Policy to your location table that when the parent field is not empty, make the inherited fields read only.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2017 09:04 AM
Hi Stephen,
Please add a onAfter - Update Businessrule with below script
Condition - Parent is Empty
var loc = new GlideRecord('cmn_location');
loc.addQuery('parent',current.sys_id);
loc.query();
while (loc.next())
{
loc.company = current.company;
loc.update();
}
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2017 09:51 AM
Hi Stephen,
Please mark answer correct, if it resolved your issue.
Thanks,
Sanjiv
Please mark this response as correct or helpful if it assisted you with your question.