Using the daily status value
How to Use Daily Status Values for Workflow Control
Overview
Daily status values are a powerful feature that allows you to control workflow availability based on whether users have completed specific prerequisite tasks. For example, you can require users to complete end-of-day tasks before accessing new workflows.
Step 1: Configure Daily Status Query in Settings
- Navigate to the Settings menu
- Select the "Users" tab
- Locate the "Daily status of user" field
- Enter your status update query that will check for your required conditions
- This query should evaluate user activities and return a boolean value
- Example: A query checking if a user has submitted their end-of-day stock count
SELECT
u.id,
CASE
WHEN v.submission_date IS NOT NULL THEN 'true'
ELSE 'false'
END as new_value
FROM
mobile_users u
LEFT JOIN visits v ON v.user_id = u.id
WHERE
v.workflow_id = 'stock_count'
AND DATE(v.submission_date) = DATE(NOW() - INTERVAL 1 DAY)
AND u.phone = ${phone}
Step 2: Configure Workflow Conditions
- Go to the Workflows section
- Find the workflow you want to restrict
- Click the "Edit" button next to the workflow
- In the workflow settings, locate and click "+ Add condition"
- Click "+ Add" to create a new condition
- Select "Create new meta expression"
Step 3: Set Up the Daily Status Check
- In the meta expression builder:
- Set Title as "daily_status"
- Target type should be "VARIABLE"
- Scope should be "USER"
- Create the condition:
- Select "daily_status" from the field options
- Choose "Equals" as the operator
- Set the value to "true"
- Click "Save" to apply the condition
How It Works
Status Update Mechanisms
- Daily Maintenance Update
- By default, the system runs your daily status query during the daily maintenance job
- This happens once per day at a scheduled time
- All users' statuses are updated during this maintenance run
- Real-Time Updates Using Workflows
- For more frequent status updates, you can add an UPDATE_QUERY_ATTRIBUTES activity to your workflows
- This ensures status is updated immediately after relevant actions are completed
How to Add Real-Time Status Updates
- Open your workflow in the Workflow Builder
- Add an UPDATE_QUERY_ATTRIBUTES activity as the last step in your workflow
- Drag the UPDATE_QUERY_ATTRIBUTES activity from the left panel
- Connect it as the final step after your main workflow activities
- The system will continuously evaluate your daily status query for each user
- When a user attempts to access the workflow:
- If their daily status = true (meaning they've completed required prerequisites), they can access the workflow
- If their daily status = false, the workflow will be unavailable
Best Practices
- Keep your status queries focused on specific requirements
- Test your conditions thoroughly before implementation
- Ensure your users understand what they need to do to unlock workflows
- Consider adding clear messaging about prerequisites in workflow descriptions
Common Issues and Troubleshooting
- If workflows remain locked despite completed prerequisites:
- Verify the daily status query is correctly written
- Check if the workflow condition is properly saved
- Ensure the user has actually completed all required tasks
Updated on: 25/11/2024
Thank you!