Change Context – returning to an earlier record¶
The command "Change Context" makes an earlier record the current record again – the record the action started with, or the record an earlier command created or opened. This page is for administrators who build actions that work on more than one record.
1. At a glance¶
| Purpose | Switch the record the following commands work on back to a record the action already had |
| Typical use | Create a related record, fill it, then continue on the record the action started with |
| Where in the editor | Toolbar menu "Flow" → "Change Context" |
| Needs a user interface | No |
| Needs a current record | No |
| Changes the current record | Yes |
| Related | Create Entity Record, Go To Record, Actions – the current record |
2. Settings¶
The setting is on the tab "Settings". Like every command, the command also has "Display Name", "Description" and "Execution Condition" on the tab "General" (see Actions).
| Setting | Meaning | Default / Required |
|---|---|---|
| "Context" | The record that becomes current. "Original Context ( |
Required |
The list offers the original context and every command before this one that changes the context – Create Entity Record, Go To Record and other Change Context commands – also those before an enclosing loop or case.
3. Behaviour¶
- While the action runs, nexxcite remembers for every command which record was current right after it, and the record the run started with as the original context. Loops, switch cases and the pre commands of the action do not change the original context, even if they work on another record.
- Change Context makes the remembered record of the chosen command the current record. All following commands work on it, until the next context change.
- The editor shows the change: the following commands are grouped under the entity of the chosen record.
- If nothing is remembered for the chosen command – because it has not run (its execution condition was false, it is in a case that did not run, or it comes later) or no context is selected – the following commands have no current record. Commands that need one are skipped or end the action. The command itself does not fail; a warning is written to the log.
The record is the same object the earlier command worked with, including changes that are not saved yet.
4. Examples¶
Back to the order after creating an invoice. An action on "Order":
- Create Entity Record "Create invoice" (entity "Invoice") – the invoice is now current.
- Update Entity Record – sets amount and due date of the invoice, "Save" on.
- Change Context – "Context": "Original Context (Order)".
- Update Entity Record – sets the status of the order to "Invoiced", "Save" on.
Back to a record created earlier. After "Create invoice", the action opens the customer with Go To Record, updates it and then continues on the invoice with "Context from "Create invoice"".
5. Limitations¶
- The record after a command is remembered when the next command in the same list starts. For the last command inside a loop or a switch case, nothing is remembered; choosing it leaves the following commands without a record.