Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

Inheritance Child to Parent

aditya111
Tera Contributor

I have Domain field and Pillar field on Task form domain field populate based on pillar field I want to inherit both the field value to Case form.

Which is Child to Parent inheritance.

1 REPLY 1

Kailash Bhange
Kilo Sage

Hi Aditya,

There's no OOB "inherit up" setting. Dot-walking only works from child to parent (task.parent.field), not the other way round, because one case can have many tasks. So you need to push the values up when the task changes. Flow Designer can do this without code:

1. Make sure the Case table (sn_customerservice_case) has its own Domain and Pillar fields with the same type and choices/reference as on the task. Create them in the same application scope as your task fields so the flow has access.
2. In Flow Designer / Workflow Studio, create a new flow:
- Trigger: Created or Updated on your task table (for example Case Task [sn_customerservice_task]).
- Condition: Parent is not empty AND (Pillar changes OR Domain changes). On "Created or Updated", set Run Trigger to "For each unique change".
3. Add the action Update Record:
- Record: Trigger > Task Record > Parent (if the task's parent field is on the base Task table, use the case reference field your task actually uses)
- Table: Case [sn_customerservice_case]
- Field values: Pillar = Trigger > Task Record > Pillar, Domain = Trigger > Task Record > Domain
4. Activate and test: create a task under a case, set Pillar, and check that both values appear on the case.

If you prefer a business rule instead of a flow, use an after Business Rule on the task table (Insert/Update, condition: Pillar changes or Domain changes):

(function executeRule(current, previous) {
if (current.parent.nil()) return;
var gc = new GlideRecord('sn_customerservice_case');
if (gc.get(current.getValue('parent'))) {
gc.setValue('u_pillar', current.getValue('u_pillar'));
gc.setValue('u_domain', current.getValue('u_domain'));
gc.update();
}
})(current, previous);

Replace u_pillar/u_domain with your actual field names. Use "after" and don't call current.update() in the rule.

A couple of things to decide:
- If a case can have several tasks with different Pillars, the last task updated wins. If that's not what you want, add a condition (for example only the first task, or a specific task type).
- Since Domain is derived from Pillar, you could copy only Pillar to the case and reuse the same logic there (for example the same Data Lookup rule or reference qualifier) to fill Domain. That keeps both forms consistent.
- Consider making the case fields read-only (UI Policy) so agents don't overwrite what comes from the task.

 

 

If this helps, please mark it helpful, or accept it as the solution if it solves your issue.