Skip to content

M6-S2 — A one-click button, built from chained reactions

Section titled “M6-S2 — A one-click button, built from chained reactions”
ModuleM6 — Make it run on time
After this session you canGive people a one-click button that runs an automation of several steps in order, safely.
TimeFacilitated: 46 min · On your own: 46 min
Before you startM6-S1: Reaction history is on in Incoming Requests.
Go deeperButtons · Run from a button: Custom Action · Chain reactions

◆ Orientation (1 min) — Three edits and a click, or one click

Section titled “◆ Orientation (1 min) — Three edits and a click, or one click”

Customers often report the same problem twice. Today the desk closes a duplicate by editing the ticket, setting Ticket status to Duplicate, saving, and selecting Close Ticket. In this session you turn that into one button, Mark as duplicate. Underneath, it is two reactions run in order: the first one changes the status, the second one closes the ticket. Building it teaches three things you need for any multi-step automation: custom actions, buttons, and chains, with the guard that stops chains from looping.

▤ Concept (5 min) — Custom actions, buttons and chains

Section titled “▤ Concept (5 min) — Custom actions, buttons and chains”

A custom action is a reaction a button can run

Section titled “A custom action is a reaction a button can run”

A button that does work needs a custom action first: a reaction whose event is Custom Action. Its Custom action level decides who may run it:

Custom action levelRun by
UI actiona button (only this level can be attached to one)
Local actionanother reaction in the same module
External actiona reaction in any module

Contextual (on by default) means it runs on a record, the one the button was clicked on.

You design a button on the entity’s Buttons tab with New Button:

  • Action: a UI custom action, or Navigation (open a form or a list, nothing saved) or Script (code in the browser; not for this course).
  • Scope: Single Entry (on a record), Multiple Entries (on a selection), or both.
  • Before Execution: Show confirmation dialog before execution, with a Dialog title and Dialog content that may carry {{…}} variables from the record (single-entry scope only).
  • Filter: which records the button is available on; For other entries, Disable button or Hide button.

Then Publish Button, and select it in each view that should show it, in the view’s Buttons section. An unpublished button, or one not selected in the view, does not appear.

One reaction does one thing, so chain them

Section titled “One reaction does one thing, so chain them”

Mark as duplicate must do two things in order: set the status, then close the ticket. A reaction has one action, so you build two reactions and chain them: the second has the event Reaction Succeeded and names the first. If the first fails, the second never runs (you could handle that with Reaction Failed).

flowchart LR
  B["Button: Mark as duplicate"] --> R1["Reaction 1: Custom Action<br/>Update Data Entry<br/>status = Duplicate"]
  R1 -->|Reaction Succeeded| R2["Reaction 2<br/>Execute Workflow Step Action<br/>Help Desk: Close Ticket"]
  R1 -.->|fails| X["Reaction 2 does not run"]

What to notice: the order is guaranteed by the chain, not by the order you created the reactions in.

Rules for a chained reaction: it must exist and be active before the first one runs; set its Execution Spaces to Triggering Space; and design it so that running twice does no harm, as a restart can occasionally repeat it. Event Executor Type decides whose authority the action uses: System (full rights), Manager, or Executor (the person whose click set it off).

Other actions you may chain later include Send Email, Create Data Entry, Call API and Execute Function, which runs code your developers wrote; that last one belongs to integrators.

A reaction that changes a record can set off other reactions on that record, and even itself: an On Entry Updated reaction that writes a field updates the record, which is an update. To stop endless loops, each action runs only once in one chain of events. The second time it would run in the same chain, it is skipped. Loop Threshold, which appears once a reaction has a filter, raises that limit; raise it only when a reaction really must run again in the same chain, and only with a filter that eventually stops matching.

⛏ Lab (33 min) — Build Mark as duplicate

Section titled “⛏ Lab (33 min) — Build Mark as duplicate”

Goal. A Mark as duplicate button in Incoming Requests that, after a confirmation, sets the status to Duplicate and closes the ticket.

Before you start. Signed in as yourself.

Reaction 1: set the status

  1. Open Support Tickets › Reactions › New Reaction and select +.
  2. Name Mark as duplicate. Event Custom Action; Custom action level UI action; keep Contextual on.
  3. Action Type Update Data Entry, Choose update mode Self. Add Ticket status with the value Manual Duplicate. Select Save.

Reaction 2: close the ticket after it

  1. Select + again. Name Close duplicate. Event Reaction Succeeded; choose the entity Support Tickets and the reaction Mark as duplicate.
  2. Set Execution Spaces to Triggering Space and Event Executor Type to System.
  3. Action Type Execute Workflow Step Action: step Help Desk, action Close Ticket. Select Save.

The button

  1. Select the Buttons tab and New Button (or Add Button). Name Mark as duplicate (Arabic تعليم كمكررة), any icon.
  2. Action: under Custom Action, pick Mark as duplicate. Scope: Single Entry.
  3. Under Before Execution, turn on Show confirmation dialog before execution. Dialog title Mark ticket {{id}} as duplicate?, with id mapped to the field Ticket number under Custom Variables; Dialog content The ticket will be closed as a duplicate.
  4. Under Filter, add the condition Ticket status not In Duplicate, Closed; set For other entries to Hide button. Select Save.
  5. Select Publish Button on the button and confirm.

Screenshot pending The New Button dialog: action Mark as duplicate, scope Single Entry, a confirmation dialog whose title carries the ticket number What to notice: the button only names the custom action; what happens is decided in the two reactions. The dialog title will show each ticket’s own number.

  1. Edit Incoming Requests. In its Buttons section, select Mark as duplicate. Save.

Try it

  1. As Customer One, open a ticket Software installation again and select Send Request.
  2. As Desk Agent, open it from Incoming Requests and select Take Ownership. Select Mark as duplicate: the dialog reads Mark ticket … as duplicate? Confirm.
  3. Reload the ticket: Ticket status is Duplicate, the workflow is complete, and the button is gone. Open its history: both reaction runs are listed.

Check.

  • Mark as duplicate is a Custom Action, UI action, updating Ticket status to Duplicate.
  • Close duplicate runs on Reaction Succeeded of Mark as duplicate, in the Triggering Space.
  • The button is published and selected in Incoming Requests.
  • The test ticket ended Duplicate, with its workflow complete, after one confirmation.
  • The button is hidden on closed and duplicate tickets.

Pass condition. One click and one confirmation on a waiting ticket leave it Duplicate with a completed workflow, and the ticket’s history shows both reactions.

If something goes wrong

What you seeWhat to do
The custom action is not offered in the button’s ActionIt must be Custom Action with level UI action on the same entity. There’s no custom events means none exists.
The button does not appear on the ticketIs it published? Selected in Incoming Requests? Does the ticket match the filter?
The dialog shows {{id}}Map id under Custom Variables, with Scope Single Entry only.
The status changed but the workflow did not closeCheck Close duplicate: Reaction Succeeded naming Mark as duplicate, Triggering Space, step Help Desk and action Close Ticket.
Nothing changed at allLook at Mark as duplicate’s run counts on the Reactions tab; a failed first reaction stops the chain.
Model answer

The design, and why:

  • The button only offers the action, confirms it with the ticket’s own number, and hides itself where it makes no sense.
  • Reaction 1 (Custom Action, UI action) sets the status: one reaction, one action.
  • Reaction 2 (Reaction Succeeded) closes the ticket only after the status was set, under System, in the Triggering Space.
  • Two reactions in a chain, not two buttons and not one reaction with two actions: the order is guaranteed, and a failure in the first stops the second.

◇ Worked scenario (1 min) — The reaction that set itself off

Section titled “◇ Worked scenario (1 min) — The reaction that set itself off”

A builder wants End date filled automatically when a ticket’s status becomes Closed. First try: a reaction on On Entry Updated, no fields watched, filter Ticket status = Closed, action Update Data Entry Self, End date = now. Follow what happens.

The desk saves the ticket as Closed. That is an update; the filter matches; the reaction writes End date. Writing End date is also an update, so the same reaction is set off again in the same chain. The filter still matches.

What stops it? The loop guard: the action has already run once in this chain, so the second run is skipped. No harm done, but the design relied on a safety net.

The better design. Make the reaction watch only Ticket status (On Entry Updated lets you pick the fields to watch). Writing End date no longer sets it off, because End date is not watched. Never raise Loop Threshold to “make it work”: a higher threshold with a filter that keeps matching just repeats the write.

✓ Practice (5 min) — Check your understanding

Section titled “✓ Practice (5 min) — Check your understanding”
PracticeChoose one answer.

A builder attaches a button to a custom action whose level is Local action. What happens when someone clicks it?

  1. Explanation for A

    ✗ Incorrect

    Not this one: a Local action is called by reactions in the same module, never by a click. See A custom action is a reaction a button can run.

  2. Explanation for B

    ✓ Correct

    Correct: buttons run UI actions only; Local and External actions are run by other reactions. See A custom action is a reaction a button can run.

  3. Explanation for C

    ✗ Incorrect

    Not this one: the button keeps its custom action; it does not fall back to navigation. See A button: what, where, when.

Check your answer

The correct answer is B. Open the explanation under each option to see why.

PracticeChoose one answer.

A purchase request must, when approved, first create a contract record and then email the supplier with the contract’s number. How do you build it?

  1. Explanation for A

    ✗ Incorrect

    Not this one: a reaction has exactly one action. See One reaction does one thing, so chain them.

  2. Explanation for B

    ✗ Incorrect

    Not this one: two reactions on one event have no guaranteed order between them. See One reaction does one thing, so chain them.

  3. Explanation for C

    ✓ Correct

    Correct: the chain guarantees the email runs only after the contract exists. See One reaction does one thing, so chain them.

Check your answer

The correct answer is C. Open the explanation under each option to see why.

PracticeDecide whether the statement is true or false.

If one reaction sets off a chain that reaches the same action a second time, the platform skips that second run unless the Loop Threshold has been raised.

  1. Explanation for A

    ✓ Correct

    Correct: each action runs once per chain of events, and Loop Threshold, available once the reaction has a filter, is what raises it. See The loop guard.

  2. Explanation for B

    ✗ Incorrect

    The loop guard does exactly this; without it a self-updating reaction would run for ever. See The loop guard.

Check your answer

The correct answer is A (True). Open the explanation under each option to see why.

PracticeChoose one answer.

The Mark as duplicate button is published but nobody sees it in Ticket Request. Nothing else is wrong. Why?

  1. Explanation for A

    ✗ Incorrect

    Not this one: the filter hides it only on Duplicate and Closed tickets. See A button: what, where, when.

  2. Explanation for B

    ✓ Correct

    Correct: publishing makes a button usable; each view chooses whether to show it. See A button: what, where, when.

  3. Explanation for C

    ✗ Incorrect

    Not this one: any person who can open the view sees its selected buttons. See A button: what, where, when.

Check your answer

The correct answer is B. Open the explanation under each option to see why.

You built a custom action, a button with a confirmation and a filter, and a chain that does two things in a guaranteed order, and you know how the loop guard protects a reaction from setting itself off. After Module 6 you can make a process keep time and do multi-step work on its own.

Next. Tickets do not yet say which product they are about. In Module 7 you link the ticket to a second entity, Products.