Update trigger doesn't see parent field of hierarchical

Posted by Pieter van Ginkel on 23-May-2014 05:07

I have an object with an hierarchical relationship. I have a trigger on this object that has On Create/On Update/On Finalize. This trigger looks at the parent relationship.

When I create a new object from inside the parent object by clicking the + sign after the list of child objects, the trigger does fire, but doesn't see the value of the parent relationship.

An example:

  • I have an object named group with a hierarchical relationship to itself, so I can nest groups;
  • I create a new group;
  • I edit the group. From the list of child groups, I click +;
  • I create a new group there. Notice that the parent group is not set, even though the new group will be added as a child group to the group I just click the +;
  • I save the new child group;
  • The child group appears in the list of children in the group I started from;
  • I save the parent group.

What happens is that the trigger does not see the parent group. If I edit the new child group, I do see the parent group set. If I then save the child group, the trigger fires again, and it does see the parent group.

How can I make the trigger see the parent group the first time around?

All Replies

Posted by Laurent on 23-May-2014 10:46

Could you do the following:

- Click on the + to create a new child group

- Click on Edit Page

- Select the Parent lookup field

On the top-left hand side, do you see the "Use Record in Scope for New Objects" checked or not?

Posted by Pieter van Ginkel on 26-May-2014 04:27

The checkbox wasn't checked. Now it is, but it doesn't help. However, before, when the checkbox wasn't checked, the parent group would be correctly set after the child and parent group were saved, even though it wasn't selected in the parent lookup. Checking the checkbox doesn't seem to change anything; neither in the UI or the trigger.

This thread is closed