ParentKey()
This pseudo-function returns a key value for populating a reference column.
Remarks
The usage of ParentKey()
is limited to the Assignments section of workflow actions. It can only be assigned directly to a reference column, without using any complex expressions or additional calculations.
The system determines which key value to use by examining the reference column you are attempting to assign. Specifically, it checks the table that the reference column is pointed to and retrieves the key value stored during preceding workflow actions.
For each table affected by a preceding action (e.g., creating or updating a record), the system maintains a single key value. When you use ParentKey()
, it retrieves this key value, ensuring that the reference column correctly links to the newly created or updated record.
Example
If you have a custom button that creates an invoice record along with several related item records, the system will store the key value of the newly created invoice record. In a subsequent Record Create action within the same button, assigning ParentKey()
to a reference column pointing to the invoice table will populate the column with the stored key value. This ensures that each item record is properly linked to the newly created invoice record.
ParentKey()
returns the key value.