Skip to tutorial content
Rate module Not yet rated

UI Action Basics

3 min read
On this page

In this lesson, you will learn:

  • What a UI action is
  • The key fields on a UI action
  • How to build a simple “Assign to me” button

1 Buttons that do things

Every button you click on a form, like Update, Resolve, or Delete, is a UI action. You can make your own! SNWR agents want a one-click Assign to me button. πŸ–±οΈ

Key term: UI action

A button, link, or menu item on a form or list that runs a script when clicked. Stored in the sys_ui_action table.

The UI action form for Assign to me on the Incident table. Marker 1: Name, the button label. Marker 2: Table is Incident. Marker 3: Action name, a unique system name. Marker 4: Show insert and Show update checkboxes. Marker 5: where it appears, with Form button checked. Marker 6: Condition, current.active and not already assigned to me. Marker 7: Script, which sets assigned_to to the current user and updates the record.
Figure 1. A UI action: what it’s called, where it shows, when it shows, and what it does.

2 Key fields

Field What it does
Name The text on the button or link
Table Which table it appears on
Action name A unique system name, used by scripts
Order Its position among other buttons
Show insert / Show update Show it on new records, existing records, or both
Client Runs in the browser instead of on the server (Lesson 38.4)
Form button, List choice, … Where it appears (Lesson 38.2)
Condition When it appears (Lesson 38.3)
Script What happens when it’s clicked

3 The script

By default, a UI action runs on the server, so you can use current, the record on the form.

current.assigned_to = gs.getUserID();   // me!
current.update();                         // save the record
action.setRedirectURL(current);           // stay on this record

πŸ’‘ Good to know: Want to see how the built-in buttons work? Right-click the form header and choose Configure > UI Actions, then open one, like “Resolve Incident”.

⚠️ Heads up: Don’t edit built-in UI actions. Copy one with Insert and Stay and change your copy, so upgrades don’t overwrite your work.

⭐ Remember: UI action = name + table + where it shows + when it shows (condition) + what it does (script).

4 Let’s try it: Assign to me

  1. Go to System Definition > UI Actions and click New.
  2. Name: Assign to me. Table: Incident. Action name: snwr_assign_to_me.
  3. Check Show update and Form button. Uncheck Show insert.
  4. Paste the script above. Submit.
  5. Open an incident that’s assigned to someone else. Click Assign to me. Are you now the assignee?

5 Quick recap

  • A UI action is a button, link, or menu item
  • It lives in sys_ui_action
  • Key parts: Name, Table, Action name, where it shows, Condition, Script
  • Server scripts use current and often action.setRedirectURL()
  • Copy built-in actions instead of changing them

6 Check yourself

Think of your answer first. Then tap to check.

1 Which table stores UI actions? Show answer

sys_ui_action.

2 You want the button only on existing records. Which checkbox do you use? Show answer

Show update (and uncheck Show insert).

3 In a server-side UI action, what object is the record on the form? Show answer

current.

Nice work! You finished this lesson. πŸŽ‰

Was this lesson helpful?

Have a question or doubt?

Ask here and get help from instructors and fellow learners.

0 / 300

Only logged-in learners can post.