Workflow Test Cases
Approval processes and automation for QuickMart Supplies.
Workflow Types Covered
| Type | Test Case | Purpose |
|---|---|---|
| Approval | #35 | Purchase Request approval based on amount |
| Approval | #36 | Customer refund request approval |
| State Machine | #37 | Customer complaint handling progression |
| Notification | #38 | Credit limit alert to sales team |
| Approval | #39 | Sales order discount override approval |
Test Case #35: Purchase Request Approval
Objective: Automatically route Purchase Requests for approval based on amount.
Scenario
Sarah (Manager) approves purchase requests over $500. Smaller requests are auto-approved.
Business Rules
APPROVAL LOGIC
-------------------------------------------------------------------------------
Amount < $500: Auto-approve (no manager needed)
Amount >= $500: Requires manager approval
Amount >= $5,000: Requires director approval
Status Flow:
Draft -> Pending Approval -> Approved -> Converted to PO
\-> Rejected
Workflow Configuration
Navigation: Customization > Workflow > Workflows > New
Step 1: Create Workflow
WORKFLOW SETUP
-------------------------------------------------------------------------------
+-----------------------------------------------------------------------------+
| BASIC INFORMATION |
+-----------------------------------------------------------------------------+
| |
| Name*: [Purchase Request Approval ] |
| ID: [customworkflow_pr_approval ] |
| Record Type*: [Purchase Request (Custom Record) v] |
| |
| [x] Active |
| |
+-----------------------------------------------------------------------------+
| INITIATION |
+-----------------------------------------------------------------------------+
| |
| Trigger On: |
| [x] Before Record Submit |
| [x] On Update |
| |
| When: [Status] [changes to] [Pending Approval] |
| |
+-----------------------------------------------------------------------------+
Step 2: Define States
WORKFLOW STATES
-------------------------------------------------------------------------------
Create the following states:
State 1: "Submitted"
+-----------------------------------------------------------------------------+
| State Name: Submitted |
| Description: Request submitted, awaiting approval decision |
| |
| Entry Conditions: |
| Status = "Pending Approval" |
+-----------------------------------------------------------------------------+
State 2: "Manager Review"
+-----------------------------------------------------------------------------+
| State Name: Manager Review |
| Description: Awaiting manager approval for requests >= $500 |
| |
| Entry Conditions: |
| Total Amount >= 500 |
+-----------------------------------------------------------------------------+
State 3: "Director Review"
+-----------------------------------------------------------------------------+
| State Name: Director Review |
| Description: Awaiting director approval for requests >= $5000 |
| |
| Entry Conditions: |
| Total Amount >= 5000 |
+-----------------------------------------------------------------------------+
State 4: "Approved"
+-----------------------------------------------------------------------------+
| State Name: Approved |
| Description: Request approved, ready for PO creation |
| |
| Entry Actions: |
| - Set Field: Status = "Approved" |
| - Set Field: Approval Date = Today |
| - Send Email: Notification to requestor |
+-----------------------------------------------------------------------------+
State 5: "Rejected"
+-----------------------------------------------------------------------------+
| State Name: Rejected |
| Description: Request rejected by approver |
| |
| Entry Actions: |
| - Set Field: Status = "Rejected" |
| - Send Email: Notification to requestor with reason |
+-----------------------------------------------------------------------------+
Step 3: Add Transitions
WORKFLOW TRANSITIONS
-------------------------------------------------------------------------------
Transition 1: Submitted -> Auto Approve (for < $500)
+-----------------------------------------------------------------------------+
| From State: Submitted |
| To State: Approved |
| |
| Trigger: Entry |
| Condition: {custrecord_pr_total} < 500 |
| |
| Result: Small requests auto-approve immediately |
+-----------------------------------------------------------------------------+
Transition 2: Submitted -> Manager Review
+-----------------------------------------------------------------------------+
| From State: Submitted |
| To State: Manager Review |
| |
| Trigger: Entry |
| Condition: {custrecord_pr_total} >= 500 AND |
| {custrecord_pr_total} < 5000 |
+-----------------------------------------------------------------------------+
Transition 3: Submitted -> Director Review
+-----------------------------------------------------------------------------+
| From State: Submitted |
| To State: Director Review |
| |
| Trigger: Entry |
| Condition: {custrecord_pr_total} >= 5000 |
+-----------------------------------------------------------------------------+
Transition 4: Manager Review -> Approved (Button)
+-----------------------------------------------------------------------------+
| From State: Manager Review |
| To State: Approved |
| |
| Trigger: Button Click |
| Button Label: [Approve] |
| |
| Actions: |
| - Set Field: Approved By = Current User |
+-----------------------------------------------------------------------------+
Transition 5: Manager Review -> Rejected (Button)
+-----------------------------------------------------------------------------+
| From State: Manager Review |
| To State: Rejected |
| |
| Trigger: Button Click |
| Button Label: [Reject] |
| |
| Prompt for: Rejection Reason (required) |
+-----------------------------------------------------------------------------+
Step 4: Add Actions
WORKFLOW ACTIONS
-------------------------------------------------------------------------------
Action: Send Approval Request Email
+-----------------------------------------------------------------------------+
| Action Type: Send Email |
| State: Manager Review (Entry) |
| |
| Recipient: Role: Manager |
| Subject: Purchase Request #{custrecord_pr_number} Needs Approval |
| Body: |
| A purchase request requires your approval. |
| |
| Requestor: {custrecord_pr_requestor} |
| Department: {custrecord_pr_dept} |
| Amount: ${custrecord_pr_total} |
| Justification: {custrecord_pr_justify} |
| |
| Click here to review: {recordurl} |
+-----------------------------------------------------------------------------+
Action: Set Approval Fields
+-----------------------------------------------------------------------------+
| Action Type: Set Field Value |
| State: Approved (Entry) |
| |
| Field: Approved By |
| Value: Current User |
| |
| Field: Approval Date |
| Value: Current Date/Time |
+-----------------------------------------------------------------------------+
Visual Workflow Diagram
PURCHASE REQUEST APPROVAL WORKFLOW
===============================================================================
+------------------+
| DRAFT |
| (Initial) |
+--------+---------+
|
| User clicks "Submit"
v
+------------------+
| SUBMITTED |
+--------+---------+
|
+---------------------------+---------------------------+
| | |
| < $500 | $500 - $4,999 | >= $5,000
| (Auto) | |
v v v
+------------------+ +------------------+ +------------------+
| APPROVED | | MANAGER REVIEW | | DIRECTOR REVIEW |
| (Auto-approve) | | | | |
+------------------+ | [Approve][Reject]| | [Approve][Reject]|
+--------+---------+ +--------+---------+
| |
+---------------+---------------+ |
| | |
v v v
+------------------+ +------------------+
| APPROVED | | REJECTED |
| | | |
| -> Create PO | | -> Notify User |
+------------------+ +------------------+
Test Steps
| Step | Action | Expected Result |
|---|---|---|
| 1 | Create PR with total $300 | Status: Draft |
| 2 | Change status to "Pending Approval" | Auto-approved (< $500) |
| 3 | Create PR with total $750 | Status: Draft |
| 4 | Submit for approval | Manager receives email |
| 5 | Manager clicks "Approve" | Status: Approved, fields set |
| 6 | Create PR with total $750, Manager rejects | Status: Rejected, notify sent |
Test Case #36: Customer Refund Request Approval
Objective: Route refund requests for approval with different thresholds.
Business Rules
REFUND APPROVAL LOGIC
-------------------------------------------------------------------------------
Refund < $100: Auto-approve
Refund $100-$500: Customer Service Manager
Refund > $500: Finance Manager
Response SLA: 24 hours
Workflow Configuration
WORKFLOW: Refund Request Approval
-------------------------------------------------------------------------------
Record Type: Case (or custom Refund Request record)
Trigger: Before Submit when Type = "Refund Request"
States:
1. New - Initial state
2. CS Manager Review - For $100-$500
3. Finance Review - For > $500
4. Approved - Approved, process refund
5. Denied - Request denied
Key Actions:
- Send approval emails with case details
- Set SLA reminder (24 hours)
- Create Credit Memo on approval
Transitions
+-----------------------------------------------------------------------------+
| Transition | Condition | Actions |
+--------------------------------+------------------------+-------------------|
| New -> Auto Approved | Amount < $100 | Create credit memo|
| New -> CS Review | Amount >= 100 AND < 500| Email CS Manager |
| New -> Finance Review | Amount >= 500 | Email Finance |
| CS Review -> Approved | Button: Approve | Set approver |
| CS Review -> Denied | Button: Deny | Send denial email |
| Finance Review -> Approved | Button: Approve | Create credit memo|
| Finance Review -> Denied | Button: Deny | Send denial email |
+-----------------------------------------------------------------------------+
Test Steps
- Create refund case for $50 → Auto-approved
- Create refund case for $250 → CS Manager receives email
- CS Manager approves → Credit memo created
- Create refund case for $750 → Finance Manager receives email
Test Case #37: Customer Complaint Handling (State Machine)
Objective: Track customer complaints through investigation and resolution stages.
Scenario
Customer complaints need proper tracking from receipt through investigation to resolution.
State Machine Design
COMPLAINT HANDLING STATE MACHINE
===============================================================================
+------------------+
| NEW COMPLAINT | Entry: Assign to CS Rep
+--------+---------+
|
| CS Rep reviews
v
+------------------+
| INVESTIGATION | Entry: Set due date (3 days)
+--------+---------+
|
+----+----+
| |
v v
+--------+ +--------+
| VALID | |INVALID | -> Close with explanation
+---+----+ +--------+
|
| Determine resolution needed
v
+------------------+
| RESOLUTION | Entry: Notify customer
+--------+---------+
|
+---------------+---------------+
| | |
v v v
+-------+ +----------+ +--------+
|REFUND | |REPLACEMENT| |DISCOUNT|
+---+---+ +-----+----+ +---+----+
| | |
+-------+-------+-------------+
|
v
+------------------+
| RESOLVED | Entry: Send satisfaction survey
+------------------+
Workflow Configuration
WORKFLOW: Complaint Handling
-------------------------------------------------------------------------------
Record Type: Case
Trigger: Create, Update
States:
1. New - Just received
2. Investigation - CS reviewing
3. Valid - Complaint verified
4. Invalid - Not valid, close
5. Resolution - Determining action
6. Resolved - Completed
Notifications:
- Customer: Status updates at each stage
- Manager: If unresolved after 3 days
- Survey: Sent upon resolution
Actions Per State
STATE ACTIONS
-------------------------------------------------------------------------------
State: New
+-----------------------------------------------------------------------------+
| Entry Actions: |
| - Assign to CS Rep (round-robin or based on category) |
| - Set Due Date: 3 business days |
| - Send acknowledgment email to customer |
+-----------------------------------------------------------------------------+
State: Investigation
+-----------------------------------------------------------------------------+
| Entry Actions: |
| - Create Investigation task |
| - Log start time |
| |
| Scheduled Actions: |
| - If in this state > 2 days: Email reminder to CS Rep |
| - If in this state > 3 days: Escalate to Manager |
+-----------------------------------------------------------------------------+
State: Resolution
+-----------------------------------------------------------------------------+
| Entry Actions: |
| - Email customer: "We're working on your resolution" |
| |
| Buttons Available: |
| [Process Refund] -> Goes to Resolved, triggers refund workflow |
| [Send Replacement] -> Creates Sales Order with no charge |
| [Apply Discount] -> Creates discount code for customer |
+-----------------------------------------------------------------------------+
State: Resolved
+-----------------------------------------------------------------------------+
| Entry Actions: |
| - Calculate resolution time |
| - Send satisfaction survey email |
| - Close case |
+-----------------------------------------------------------------------------+
Test Steps
- Create Case with type "Complaint"
- Verify auto-assigned to CS Rep
- CS Rep moves to Investigation
- Verify due date set and email sent
- Wait 3+ days → Verify escalation to manager
- Mark as Valid, choose resolution
- Complete resolution → Verify survey sent
Test Case #38: Low Credit Alert Notification
Objective: Alert sales team when customer credit utilization exceeds threshold.
Scenario
Mike (Sales) needs to know when his customers are near their credit limit to manage risk and discuss payment terms.
Workflow Configuration
WORKFLOW: Credit Limit Alert
-------------------------------------------------------------------------------
Record Type: Customer
Trigger: After Submit (when balance changes)
Condition:
({balance} / {creditlimit}) >= 0.80
AND {creditlimit} > 0
Actions:
1. Send email to assigned Sales Rep
2. Create Task for follow-up
3. Add message to customer record
Detailed Configuration
WORKFLOW SETUP
-------------------------------------------------------------------------------
+-----------------------------------------------------------------------------+
| BASIC INFORMATION |
+-----------------------------------------------------------------------------+
| |
| Name*: [Credit Limit Alert ] |
| ID: [customworkflow_credit_alert ] |
| Record Type*: [Customer v] |
| |
+-----------------------------------------------------------------------------+
| INITIATION |
+-----------------------------------------------------------------------------+
| |
| Trigger On: [x] After Record Submit |
| |
| Condition Formula: |
| {balance} > 0 AND |
| {creditlimit} > 0 AND |
| ({balance} / {creditlimit}) >= 0.80 |
| |
+-----------------------------------------------------------------------------+
State: Check Credit
STATE: Check Credit
-------------------------------------------------------------------------------
Entry Actions:
1. Send Email
+-----------------------------------------------------------------------------+
| Action Type: Send Email |
| |
| Recipient: {salesrep} (Sales Rep on Customer) |
| |
| Subject: ALERT: Credit Limit Reached - {companyname} |
| |
| Body: |
| Customer {companyname} has reached 80%+ of their credit limit. |
| |
| Credit Limit: ${creditlimit} |
| Current Balance: ${balance} |
| Utilization: {formula: ROUND((balance/creditlimit)*100, 0)}% |
| |
| Please contact the customer to discuss payment or credit adjustment. |
| |
| View Customer: {recordurl} |
+-----------------------------------------------------------------------------+
2. Create Task
+-----------------------------------------------------------------------------+
| Action Type: Create Record |
| Record Type: Task |
| |
| Field Values: |
| Title: Credit Follow-up: {companyname} |
| Assigned To: {salesrep} |
| Due Date: Today + 3 days |
| Priority: High |
| Company: {id} (Current Customer) |
+-----------------------------------------------------------------------------+
3. Add Message
+-----------------------------------------------------------------------------+
| Action Type: Add Message |
| |
| Message: Credit alert triggered at {balance}/{creditlimit} |
| ({formula}% utilization) |
+-----------------------------------------------------------------------------+
Test Steps
- Create customer with credit limit $10,000
- Create invoices totaling $8,000 (80%)
- Verify:
- Sales Rep receives email alert
- Task created for follow-up
- Message added to customer record
- Create additional invoice ($500)
- Verify: Another alert triggered (now 85%)
Test Case #39: Sales Order Discount Approval
Objective: Require approval when manual discounts exceed policy threshold.
Scenario
Mike (Sales) sometimes applies large discounts. Management wants approval for discounts over 15%.
Business Rules
DISCOUNT APPROVAL LOGIC
-------------------------------------------------------------------------------
Discount <= 15%: Auto-approve
Discount > 15%: Requires Sales Manager approval
Workflow Configuration
WORKFLOW: Sales Order Discount Approval
-------------------------------------------------------------------------------
Record Type: Sales Order
Trigger: Before Submit, On Create/Update
Condition Formula:
{subtotal} > 0 AND ({totaldiscount} / {subtotal}) >= 0.15
States:
1. New - Initial
2. Manager Review - Approval required
3. Approved - Order released
4. Rejected - Notify sales rep
Test Steps
- Create Sales Order with 10% discount
- Verify: Order auto-approved
- Create Sales Order with 20% discount
- Verify: Manager review required and approval email sent
- Manager approves
- Verify: Order moves to Approved state
Workflow Best Practices
Design Principles
| Principle | Description |
|---|---|
| Single Responsibility | Each workflow handles one process |
| Clear States | State names describe what's happening |
| Defined Exits | Every path leads to completion |
| Timeout Handling | Escalate stuck items |
| Audit Trail | Log all state changes |
Testing Checklist
- All states reachable
- No dead-end states
- Timeout escalations work
- Emails contain correct data
- Buttons visible to correct roles
- Conditions evaluate correctly
- Performance acceptable
Common Issues
| Issue | Solution |
|---|---|
| Workflow not triggering | Check trigger conditions, record type |
| Email not sending | Verify recipient field, email template |
| Button not visible | Check role permissions on state |
| Stuck in state | Add timeout transition |
| Duplicate workflows run | Add "only once" condition |
Summary: All Test Cases Complete
QUICKMART SUPPLIES - TEST CASE SUMMARY
===============================================================================
+-----------------------------------------------------------------------------+
| Category | Count | Test Cases |
+-----------------+-------+--------------------------------------------------|
| SuiteBuilder | 11 | Custom lists, records, fields, forms, |
| | | integration logging |
+-----------------+-------+--------------------------------------------------|
| SuiteScript | 22 | Client Script, User Event, Scheduled, |
| | | Map/Reduce, RESTlet, Suitelet, PDF output |
+-----------------+-------+--------------------------------------------------|
| Integration | 9 | Push Out, Pull In, Receive, Expose patterns |
+-----------------+-------+--------------------------------------------------|
| Workflow | 5 | Approvals, State Machine, Notifications |
+-----------------+-------+--------------------------------------------------|
| TOTAL | 47 | Complete implementation for QuickMart |
+-----------------------------------------------------------------------------+