Updating a Field in a Related Record during a Data Policy "Update Record" Action
From ISV Support Wiki
Updating a Field in a Related Record during a Data Policy "Update Record" Action
When performing an Update Record in a Data Policy, it is possible to update a field in a related record (one that is the target of a Lookup), as well as a field in the original record.
To do that, you use the cascading "dot" notation. For example, the Order object has a Lookup to Customer. If the Customer object has a field called phone then, when updating an order, it is possible to update the customer's phone number at the same time:
- order.customer.phone = 8005551111
To update a field in a related record:
- Go to Data Policy > Add Action
- Chose Update Record
- The "Choose field" drop down gives a list of current object fields.
- Lookup fields are marked with a ">" after the name
- Select a lookup field.
- A new list box opens, displaying fields from the target object
- You can continue selecting lookup fields in that manner, until you get to the maximum possible depth (5 or 6 references).
- At that point, Lookup fields are no longer displayed.
- Considerations
-
- It is not possible to select a Lookup field itself, to update it. For that, use Java code.
- Updating a referenced object in a Data Policy does not trigger any Data Policies that may exist on that object.
- If the Lookup field is empty (it does not point to a target record), then nothing happens when the Update Record action fires.
- These fields in a related record cannot be updated:
- File Field
- Image Field
- If a user changes the Lookup target at a later date, previous updates are not affected.
- For example:
- Record A1 looks up to B1.
- A1 is updated, which causes B1 to be updated, so now it's value is B1' (prime)
- The lookup in A1 is changed, so it now points to B2.
- Record B1 is not changed. Its set of values remains as B1' (prime).
- To maintain referential integrity in the platform, it is not possible to delete a field that is used in a Data Policy or a Formula reference.