Issues with CONTEXT("RowKey") when creating rows via nested actions

Hi,

I’m implementing a BOM-driven movement posting and facing issues with CONTEXT("RowKey") during nested action execution.

Data Structure

BOM

• Key ID

BOMLI (child of BOM)

• Key ID
• BOM ID (Ref to BOM)
• Inventory ID
• BOM Line Item Type: Production/Consumption
• BOMLI Input Quantity

TRN

• Key ID
• BOM ID (Ref → BOM)

MOV (child of TRN)

• Key ID
• Transaction ID (Ref to TRN)
• Movement Type: Production/Consumption
• Inventory ID
• Input Quantity

Goal

When a user presses Post Consumptions on a TRN record, the app should:

  1. Read BOMLI lines for the selected BOM

  2. Filter rows where [BOM Line Item Type] = "Consumption"

  3. Create MOV lines linked to the TRN

Action Structure

Action 1 – Post Consumptions

For a record of this table: BOMLI

Type: Data: add a new row to another table using values from this row

Target table: MOV

Set columns:

Transaction ID: CONTEXT("RowKey")

Movement Type: [BOM Line Item Type]

Inventory ID: [Inventory ID]

Note: The Input Quantity field in the MOV table already contains the quantity calculation logic in its Initial Value.

Action 2 – Post Consumptions (Ref)

For a record of this table: TRN

Type: Data: Execute an action on a set of rows

Referenced table: BOMLI

Referenced rows:

SELECT( BOMLI[Key ID], AND( [BOM ID] = [_THISROW].[BOM ID], [BOM Line Item Type] = "Consumption" ) )

Referenced action: Post Consumptions

Issue

CONTEXT("RowKey") appears to return the Key ID of the BOMLI, not the Key ID of the TRN, when the action runs. As a result, the MOV receives the wrong Transaction ID.

Debugging

When I hardcoded the Transaction ID, the MOV lines were created correctly and linked to the TRN. So it seems the issue is specifically how CONTEXT("RowKey") behaves inside nested actions.

Question

Is CONTEXT("RowKey") expected to return the current action’s Key ID (BOMLI in this case)?

If so, what is the recommended pattern to pass the Key ID of the TRN into the Post Consumptions action when executing nested actions like this?

Thanks in advance for any guidance!

There is no such thing as CONTEXT("RowKey"), your AI is hallucinating.

2 Likes

Even I couldn’t find any official documentation on CONTEXT(“RowKey”), except a topic referencing on using CONTEXT(“RowKey”)!

Yep, your AI made it up. That’s a weakness of “generative AI”, and why they all have disclaimers saying something to the effect of, “AI makes mistakes, check the results”.

5 Likes