Articles on: Web App

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


  1. Navigate to the Settings menu
  2. Select the "Users" tab
  3. Locate the "Daily status of user" field
  4. 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


  1. Go to the Workflows section


  1. Find the workflow you want to restrict


  1. Click the "Edit" button next to the workflow


  1. In the workflow settings, locate and click "+ Add condition"

  1. Click "+ Add" to create a new condition


  1. Select "Create new meta expression"



Step 3: Set Up the Daily Status Check


  1. In the meta expression builder:


  • Set Title as "daily_status"


  • Target type should be "VARIABLE"


  • Scope should be "USER"


  1. Create the condition:


  • Select "daily_status" from the field options


  • Choose "Equals" as the operator


  • Set the value to "true"


  1. Click "Save" to apply the condition


How It Works


Status Update Mechanisms


  1. 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


  1. 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


  1. Open your workflow in the Workflow Builder


  1. 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


  1. Keep your status queries focused on specific requirements
  2. Test your conditions thoroughly before implementation
  3. Ensure your users understand what they need to do to unlock workflows
  4. 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

Was this article helpful?

Share your feedback

Cancel

Thank you!