Dynamically Generating a @Table record .Reference within Trigger Expression Editor

Good day,

I’ll admit I only took a quick stab at this; I sense that within the Expression editor the “@” values are validated and resolved to their respective internal ID – not complied with each run through. I figured it couldn’t’ hurt to ask.

Summary
I was hoping to construct a @TableRecord reference, within a trigger expression – made up of the value from another table record or variable.

For Example, we may have an Orders table record loaded that has numerous fields we want to use the data from.
@Table Record.Orders.

I have another Table record that contains the particular column/field within the Orders record that I need to leverage – it is different for each product. (Part of a step loop creating a JSON payload)

For Example:
@Table Record.NeededPayload.Field
Contains the value : Item

Next run through the loop
@Table Record.NeededPayload.Field
Contains the value : PO

Currently I have each possible Field value defined as a condition – with an expression with then a statically declared table record value for the Orders
IF field value = Item Then
@Table Record.Orders.Item

IF field value = PO then
@Table Record.Orders.PO … etc

These may be just picking up the value, or they may be part of a transformation of some sort.

I would like to be able to just have a single expression to handle all of the similar patterns (just handling one on each pass of the loop). So something like this

IF Any
@Table Record.NeededPayload.Field = Item
@Table Record.NeededPayload.Field = PO

Then Data Manipulation
Store Expression LINK((‘@Table Record.Orders.’+@Table Record.NeededPayload.Field)),’’)
Store To the Variable I’m using.

I do get a concatenation – but the value is just the concatenated string, not the value from the Orders table record – ex just ‘@Table Record.Orders.Item’

Any thoughts or input would be appreciated.

Thanks!
Chris

Thanks @cmatthews this is a very well written and tech-savvy question about trying to dynamically create references or cycle through linked lists.

I’ll share with the team to see if they have any ideas on how to make this easier today within the low-code/no-code Trigger interface. We’ll circle back after the holidays.

To prep - could I ask you to get a bit more information about your use case.

It sounds like you’re hoping to loop through say linked records or related fields to a primary Order, is that right?

Have you already tried to do this in Automations with Loops?

  • Olga

Hello @OlgaStroilova ,
Apologies for the delay - I didn’t get a notification of your reply.

The current use (in place and working) is looping though a series of detail fields to generate a JSON payload. If that detail field requires a variable, the Trigger I’m trying to optimize looks at the variable (as a conditional) and determines which related table+field to pick it up from.

Since many of these share the same model/syntax it would be nice to have a single condition within the trigger for each similar group. There was some intention with the naming the variables & fields in hopes of this dynamic composition.

I don’t believe the dynamic approach would necessarily optimize the actual execution; I am more looking to minimize the maintenance and readability of this trigger when we add new variables.

I have not utilized Automations for this approach or honestly in any capacity yet.

Thanks again for your response.
Chris