Workflow Actions
Actions define what happens at each stage of your workflow - from setting field values to sending emails and running scripts.
Action Types Overview
WORKFLOW ACTION TYPES
═══════════════════════════════════════════════════════════════════════════════
┌─────────────────────────────────────────────────────────────────────────────┐
│ FIELD ACTIONS │
├─────────────────────────────────────────────────────────────────────────────┤
│ • Set Field Value │ Change field to specific value │
│ • Set Field Mandatory │ Make field required │
│ • Set Field Display │ Show/hide/disable field │
└─────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────┐
│ COMMUNICATION ACTIONS │
├─────────────────────────────────────────────────────────────────────────────┤
│ • Send Email │ Send notification email │
│ • Show Message │ Display message to user │
└─────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────┐
│ RECORD ACTIONS │
├─────────────────────────────────────────────────────────────────────────────┤
│ • Create Record │ Create related record │
│ • Transform Record │ Transform to another record type │
│ • Lock Record │ Prevent editing │
└─────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────┐
│ ADVANCED ACTIONS │
├─────────────────────────────────────────────────────────────────────────────┤
│ • Custom Action │ Run workflow action script │
│ • Initiate Workflow │ Start another workflow │
│ • Add Button │ Add workflow button │
│ • Remove Button │ Remove workflow button │
│ • Go to State │ Move to different state │
└─────────────────────────────────────────────────────────────────────────────┘
Action Trigger Types
WHEN ACTIONS EXECUTE
═══════════════════════════════════════════════════════════════════════════════
┌─────────────────────────────────────────────────────────────────────────────┐
│ ENTRY ACTIONS │
│ ───────────── │
│ Execute when entering a state │
│ │
│ Use for: │
│ • Setting initial status │
│ • Sending notification emails │
│ • Locking records for review │
│ • Adding workflow buttons │
└─────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────┐
│ EXIT ACTIONS │
│ ──────────── │
│ Execute when leaving a state │
│ │
│ Use for: │
│ • Logging/audit trail │
│ • Cleanup temporary data │
│ • Removing workflow buttons │
└─────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────┐
│ BEFORE RECORD SUBMIT │
│ ──────────────────── │
│ Execute before record saves │
│ │
│ Use for: │
│ • Validation │
│ • Setting calculated fields │
│ • Preventing save if conditions not met │
└─────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────┐
│ AFTER RECORD SUBMIT │
│ ─────────────────── │
│ Execute after record saves │
│ │
│ Use for: │
│ • Creating related records │
│ • Sending confirmation emails │
│ • External integrations │
└─────────────────────────────────────────────────────────────────────────────┘
Set Field Value
Static Value
SET STATIC VALUE
═══════════════════════════════════════════════════════════════════════════════
Set field to a fixed value:
┌─────────────────────────────────────────────────────────────────────────────┐
│ Action Configuration: │
│ ┌───────────────────────────────────────────────────────────────────────┐ │
│ │ Trigger: On Entry │ │
│ │ Field: Approval Status │ │
│ │ Value Type: Static Value │ │
│ │ Value: Pending Approval │ │
│ └───────────────────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────────┘
XML:
<setfieldvalueaction>
<field>STDBODYAPPROVALSTATUS</field>
<valuetype>STATIC</valuetype>
<value>Pending Approval</value>
</setfieldvalueaction>
Dynamic Value (From Field)
SET VALUE FROM ANOTHER FIELD
═══════════════════════════════════════════════════════════════════════════════
Copy value from another field:
┌─────────────────────────────────────────────────────────────────────────────┐
│ Action Configuration: │
│ ┌───────────────────────────────────────────────────────────────────────┐ │
│ │ Trigger: On Entry │ │
│ │ Field: Approved By │ │
│ │ Value Type: Field Value │ │
│ │ Value Field: Current User │ │
│ └───────────────────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────────┘
XML:
<setfieldvalueaction>
<field>custbody_approved_by</field>
<valuetype>FIELD</valuetype>
<valuefield>currentuser</valuefield>
</setfieldvalueaction>
Formula Value
SET VALUE USING FORMULA
═══════════════════════════════════════════════════════════════════════════════
Calculate value using formula:
┌─────────────────────────────────────────────────────────────────────────────┐
│ Action Configuration: │
│ ┌───────────────────────────────────────────────────────────────────────┐ │
│ │ Trigger: On Entry │ │
│ │ Field: Due Date │ │
│ │ Value Type: Formula │ │
│ │ Formula: {today} + 30 │ │
│ └───────────────────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────────┘
Common Formulas:
┌─────────────────────────────────────────────────────────────────────────────┐
│ {today} │ Current date │
│ {today} + 30 │ 30 days from now │
│ {now} │ Current date/time │
│ {total} * 0.1 │ 10% of total │
│ {quantity} * {rate} │ Calculate amount │
│ CONCAT({tranid}, '-APP') │ Concatenate strings │
└─────────────────────────────────────────────────────────────────────────────┘
XML:
<setfieldvalueaction>
<field>duedate</field>
<valuetype>FORMULA</valuetype>
<value>{today}+30</value>
</setfieldvalueaction>
Send Email
Basic Email
SEND EMAIL ACTION
═══════════════════════════════════════════════════════════════════════════════
Send notification email:
┌─────────────────────────────────────────────────────────────────────────────┐
│ Email Configuration: │
│ ┌───────────────────────────────────────────────────────────────────────┐ │
│ │ Recipient: Field Value → custbody_approver │ │
│ │ Sender: Current User │ │
│ │ Subject: Approval Required: {tranid} │ │
│ │ │ │
│ │ Body: │ │
│ │ ┌─────────────────────────────────────────────────────────────────┐ │ │
│ │ │ Please review and approve the following transaction: │ │ │
│ │ │ │ │ │
│ │ │ Transaction: {tranid} │ │ │
│ │ │ Vendor: {entity} │ │ │
│ │ │ Amount: ${total} │ │ │
│ │ │ Date: {trandate} │ │ │
│ │ │ │ │ │
│ │ │ Click here to view: {recordurl} │ │ │
│ │ └─────────────────────────────────────────────────────────────────┘ │ │
│ └───────────────────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────────┘
XML:
<sendemailaction>
<recipientfield>custbody_approver</recipientfield>
<recipientisemail>F</recipientisemail>
<senderfield>currentuser</senderfield>
<subject>Approval Required: {tranid}</subject>
<body>Please review transaction {tranid} for ${total}</body>
<includerecordlink>T</includerecordlink>
</sendemailaction>
Using Email Template
SEND EMAIL WITH TEMPLATE
═══════════════════════════════════════════════════════════════════════════════
Use pre-defined email template:
┌─────────────────────────────────────────────────────────────────────────────┐
│ Template Email Configuration: │
│ ┌───────────────────────────────────────────────────────────────────────┐ │
│ │ Recipient: Field Value → createdby │ │
│ │ Sender: Specific Employee → finance@company.com │ │
│ │ Use Template: ☑ │ │
│ │ Template: Invoice Approval Notification │ │
│ └───────────────────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────────┘
XML:
<sendemailaction>
<recipientfield>createdby</recipientfield>
<sender>-5</sender> <!-- Employee internal ID -->
<usetemplate>T</usetemplate>
<template>Email Template Name</template>
</sendemailaction>
Multiple Recipients
SEND TO MULTIPLE RECIPIENTS
═══════════════════════════════════════════════════════════════════════════════
Configuration Options:
┌─────────────────────────────────────────────────────────────────────────────┐
│ Primary Recipient: │
│ Field: custbody_approver │
│ │
│ CC Recipients: │
│ ☑ Record Creator │
│ ☑ Sales Rep │
│ ☑ Field: custbody_notify_email │
│ │
│ BCC Recipients: │
│ ☑ Specific: compliance@company.com │
└─────────────────────────────────────────────────────────────────────────────┘
Lock Record
LOCK/UNLOCK RECORD
═══════════════════════════════════════════════════════════════════════════════
Prevent or allow record editing:
LOCK (on entering Pending state):
┌─────────────────────────────────────────────────────────────────────────────┐
│ Record is locked - users cannot edit while in approval │
└─────────────────────────────────────────────────────────────────────────────┘
<lockrecordaction>
<locked>T</locked>
</lockrecordaction>
UNLOCK (on entering Approved/Rejected state):
┌─────────────────────────────────────────────────────────────────────────────┐
│ Record is unlocked - users can edit again │
└─────────────────────────────────────────────────────────────────────────────┘
<lockrecordaction>
<locked>F</locked>
</lockrecordaction>
Create Record
CREATE RELATED RECORD
═══════════════════════════════════════════════════════════════════════════════
Create audit log or related record:
┌─────────────────────────────────────────────────────────────────────────────┐
│ Create Record Configuration: │
│ ┌───────────────────────────────────────────────────────────────────────┐ │
│ │ Record Type: Custom Record - Approval Log │ │
│ │ │ │
│ │ Field Mappings: │ │
│ │ ┌─────────────────────────────────────────────────────────────────┐ │ │
│ │ │ Target Field │ Source │ │ │
│ │ ├───────────────────────┼─────────────────────────────────────────┤ │ │
│ │ │ custrecord_al_record │ Current Record ID │ │ │
│ │ │ custrecord_al_action │ Static: "Submitted for Approval" │ │ │
│ │ │ custrecord_al_user │ Current User │ │ │
│ │ │ custrecord_al_date │ Now │ │ │
│ │ │ custrecord_al_amount │ Field: total │ │ │
│ │ └─────────────────────────────────────────────────────────────────┘ │ │
│ └───────────────────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────────┘
XML:
<createrecordaction>
<recordtype>customrecord_approval_log</recordtype>
<createrecordfield>
<field>custrecord_al_record</field>
<valuefield>id</valuefield>
</createrecordfield>
<createrecordfield>
<field>custrecord_al_action</field>
<value>Submitted for Approval</value>
</createrecordfield>
<createrecordfield>
<field>custrecord_al_user</field>
<valuefield>currentuser</valuefield>
</createrecordfield>
<createrecordfield>
<field>custrecord_al_date</field>
<valuetype>STATIC</valuetype>
<value>NOW</value>
</createrecordfield>
</createrecordaction>
Custom Action (Script)
CUSTOM WORKFLOW ACTION SCRIPT
═══════════════════════════════════════════════════════════════════════════════
Run custom SuiteScript for complex logic:
┌─────────────────────────────────────────────────────────────────────────────┐
│ Custom Action Configuration: │
│ ┌───────────────────────────────────────────────────────────────────────┐ │
│ │ Script: customscript_approval_logic │ │
│ │ Deployment: customdeploy_approval_logic │ │
│ │ │ │
│ │ Parameters: │ │
│ │ ┌─────────────────────────────────────────────────────────────────┐ │ │
│ │ │ Parameter │ Value │ │ │
│ │ ├────────────────────────┼────────────────────────────────────────┤ │ │
│ │ │ custscript_action_type │ "approve" │ │ │
│ │ │ custscript_notify │ T │ │ │
│ │ └─────────────────────────────────────────────────────────────────┘ │ │
│ └───────────────────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────────┘
XML:
<customaction>
<scriptid>customscript_approval_logic</scriptid>
<scriptdeploymentid>customdeploy_approval_logic</scriptdeploymentid>
<parameters>
<parameter>
<name>custscript_action_type</name>
<value>approve</value>
</parameter>
</parameters>
</customaction>
Use Custom Actions For:
┌─────────────────────────────────────────────────────────────────────────────┐
│ • Complex calculations │
│ • External API calls │
│ • Creating multiple related records │
│ • Custom validation logic │
│ • File operations │
│ • Line-level processing │
└─────────────────────────────────────────────────────────────────────────────┘
Add/Remove Button
WORKFLOW BUTTONS
═══════════════════════════════════════════════════════════════════════════════
ADD BUTTON (on state entry):
┌─────────────────────────────────────────────────────────────────────────────┐
│ Configuration: │
│ ┌───────────────────────────────────────────────────────────────────────┐ │
│ │ Button Label: Approve │ │
│ │ Transition: To Approved State │ │
│ │ Condition: {currentuser.role} = 'Manager' │ │
│ │ Confirmation: Are you sure you want to approve? │ │
│ └───────────────────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────────┘
REMOVE BUTTON (on state exit):
┌─────────────────────────────────────────────────────────────────────────────┐
│ Remove workflow buttons when leaving state │
│ (Buttons auto-remove when transitioning to new state) │
└─────────────────────────────────────────────────────────────────────────────┘
Button Visibility:
┌─────────────────────────────────────────────────────────────────────────────┐
│ Role-Based: Only show to specific roles │
│ Condition-Based: Only show when condition is met │
│ State-Based: Only show in specific states │
└─────────────────────────────────────────────────────────────────────────────┘
Show Message
DISPLAY MESSAGE TO USER
═══════════════════════════════════════════════════════════════════════════════
Show confirmation or alert message:
┌─────────────────────────────────────────────────────────────────────────────┐
│ Message Configuration: │
│ ┌───────────────────────────────────────────────────────────────────────┐ │
│ │ Message: Transaction has been submitted for approval. │ │
│ │ Type: Confirmation │ │
│ └───────────────────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────────┘
Message Types:
┌─────────────────────────────────────────────────────────────────────────────┐
│ Confirmation │ Green/success message │
│ Warning │ Yellow/warning message │
│ Error │ Red/error message (can block save) │
│ Information │ Blue/info message │
└─────────────────────────────────────────────────────────────────────────────┘
Action Conditions
Conditional Execution
CONDITIONAL ACTIONS
═══════════════════════════════════════════════════════════════════════════════
Only execute action when condition is met:
┌─────────────────────────────────────────────────────────────────────────────┐
│ Action: Send Email to CFO │
│ Condition: {total} > 50000 │
│ │
│ (Only send email if amount exceeds $50,000) │
└─────────────────────────────────────────────────────────────────────────────┘
XML:
<sendemailaction>
<condition>
<formula>{total} > 50000</formula>
</condition>
<recipientemail>cfo@company.com</recipientemail>
<subject>High Value Approval: {tranid}</subject>
</sendemailaction>
Action Execution Order
ORDER OF ACTION EXECUTION
═══════════════════════════════════════════════════════════════════════════════
When multiple actions on same trigger:
┌─────────────────────────────────────────────────────────────────────────────┐
│ State Entry Actions (execute in order listed): │
│ │
│ 1. Set Field Value: Status = "Pending" │
│ 2. Lock Record │
│ 3. Send Email to Approver │
│ 4. Add Approve Button │
│ 5. Add Reject Button │
│ │
│ Actions execute top-to-bottom as configured │
│ Reorder in UI to change execution sequence │
└─────────────────────────────────────────────────────────────────────────────┘
Complete Entry Actions Example
<!-- Pending Approval State - Entry Actions -->
<workflowactions triggertype="ENTRY">
<!-- 1. Set Status -->
<setfieldvalueaction>
<field>STDBODYAPPROVALSTATUS</field>
<value>Pending Approval</value>
</setfieldvalueaction>
<!-- 2. Set Submitted Date -->
<setfieldvalueaction>
<field>custbody_submitted_date</field>
<valuetype>STATIC</valuetype>
<value>NOW</value>
</setfieldvalueaction>
<!-- 3. Set Submitted By -->
<setfieldvalueaction>
<field>custbody_submitted_by</field>
<valuetype>FIELD</valuetype>
<valuefield>currentuser</valuefield>
</setfieldvalueaction>
<!-- 4. Lock Record -->
<lockrecordaction>
<locked>T</locked>
</lockrecordaction>
<!-- 5. Send Email to Approver -->
<sendemailaction>
<recipientfield>custbody_approver</recipientfield>
<senderfield>currentuser</senderfield>
<subject>Approval Required: {tranid}</subject>
<body>Please review and approve {tranid} for ${total}</body>
<includerecordlink>T</includerecordlink>
</sendemailaction>
<!-- 6. Create Audit Log Entry -->
<createrecordaction>
<recordtype>customrecord_approval_log</recordtype>
<createrecordfield>
<field>custrecord_log_record</field>
<valuefield>id</valuefield>
</createrecordfield>
<createrecordfield>
<field>custrecord_log_action</field>
<value>Submitted for Approval</value>
</createrecordfield>
<createrecordfield>
<field>custrecord_log_user</field>
<valuefield>currentuser</valuefield>
</createrecordfield>
</createrecordaction>
</workflowactions>
Next Steps
| Goal | Go To |
|---|---|
| Define conditions | Conditions & Formulas → |
| Schedule workflows | Scheduled Workflows → |
| Return to Workflows | Workflows Overview → |