English
English
English
English
Blocks are instructions that contain other instructions. They don't write data themselves — they decide which of the operations inside them get to run, and how many times. Two blocks exist in the spec language: if_else for branching, and for_each for looping.
Use this when you want different things to happen depending on a condition — write one kind of activity for closed deals, a different kind for open deals; only run an upsert when the source field is non-empty; route to a different code path for one specific pipeline.
conditionrequiredbooleanA boolean expression. Anything that returns a boolean works — equals, greater_than, is_empty, and/or combining several of them.
thenrequiredinstruction listThe instructions to run if the condition is true.
elseoptionalinstruction listThe instructions to run if the condition is false. Leave empty if there's nothing to do in that case — many specs only use the then branch.
Example
A common pattern: if a contact has a date of birth, write an extra activity capturing it; otherwise skip.
is_empty(form.dateOfBirth)upsert_activity that uses the date of birthThe TapRaise application form processor uses exactly this shape — without it, every form without a birth date would either error or write a malformed activity.
Use this when your source delivers a list of items inside a single source-model record and you need to do something for each one — iterate over the line items in an order, the custom fields on a contact, the team memberships of a contact. Inside the body, a new variable is in scope (the iteration item) that you reference by whatever name you chose in item_var.
listrequiredarrayThe expression that produces the list to iterate over. Typically a var referencing an array field on the source model or an enrichment.
item_varrequiredstringThe name to give the current item inside the body. Appears in the variable scope only inside the loop. Typing field here, for example, lets you reference field.id and field.value from instructions inside the body.
bodyrequiredinstruction listThe instructions to run for each item. Anything you'd put at the top level of a spec works here — operations, more if_else blocks, even nested for_each loops.
Example
A processor on a source that delivers contacts with a list of custom fields needs to find one specific custom field and react to its value. The pattern: iterate over the custom-field list, and inside the body use if_else to test for the field you care about.
event.ghl_opportunity.ghl_contact.customFieldsfieldif_else whose condition compares field.id to a known custom-field ID, with the matching branch using field.value to set an activity propertyThis is how the GHL stage-change processor decides whether to add a [Setter] suffix to the activity type, and how it captures license values into a parallel activity.