menu

Efficient Task Management: How to Leverage InfoLobby Checklists for Seamless Updates


InfoLobby's text editor provides a handy checklist feature, allowing you to create and manage task lists directly within your entries. This powerful tool can be further enhanced with workflow automation, enabling you to automatically update task statuses based on checklist completion.

Here's a demo of what we are going to achieve in this tutorial.

Prerequisites

Before proceeding with this tutorial, ensure you have the following prerequisites in place:

  • InfoLobby account with administrator privileges

  • Basic understanding of PHP regular expressions

  • Familiarity with InfoLobby's workflow automation feature

Creating the table

Create a new table named "Task Checklist".

  • Title  (Text Field) - Stores the title of the task

  • Sub Tasks (Text Area) - Stores the checklist in HTML format

  • Status (Select) - Indicates the status of the task (Open or Completed)

Creating the Workflow Automation

  • Navigate to Table Settings > Automations.

  • Click on the "New Flow" button.

  • Give the automation a name

  • Select "When a record is updated" as the trigger for your workflow.

  • Here's the technical description of what the flow will do.

    • This process involves PHP to assess a checklist in a text area. The checklist, represented as an unordered list ("ul"), contains items within list elements ("li"). Checked items have the "tox-checklist--checked" class.

    • Using preg_match, PHP extracts checklist items. A loop checks each item for the specified class, adding matching items to an array. After the loop, the script compares total checklist items to the array. If no difference exists, signaling all items are checked, it returns "OK"; otherwise, it returns the array of checked items.

  • In the Actions, add a Calculate Variable brick. Name it. Add the following code in the value field. In the below code, you have to replace the variable name in the first line with your variable name. You can do that by pressing "@" and choosing the sub-tasks field from the list.

$html = @{current:sub-tasks};//Checklist Variable
$liStartPos = strpos($html, '$checkedItems = [];
$num = 0;
while ($liStartPos !== false) {
    $num = $num+1;
    $liEndPos = strpos($html, '', $liStartPos);
    preg_match('/]*>(.*?)<\/li>/s', substr($html, $liStartPos, $liEndPos - $liStartPos + 5), $matches);
    $liTextContent = strip_tags($matches[1]);
    if (strpos(substr($html, $liStartPos, $liEndPos - $liStartPos + 5), 'tox-checklist--checked') !== false) {
        array_push($checkedItems, $liTextContent);
    }
    $liStartPos = strpos($html, '}
if($num == count($checkedItems)){
    RETURN "OK"
}else{
    RETURN $checkedItems
}
  • Next, add two conditional IF statements to handle the outcome of the checklist completion check. If the check returns "OK", indicating all items are complete, update the task status to "Completed". Conversely, if the check returns a list of unchecked items, indicating incomplete tasks, update the task status to "Open". 

  • Click the "Save" button to save and apply the workflow automation.

Test the functionality

To verify the functionality of the automated checklist completion status update:

  • Create a task item with a sub-task checklist.

  • Open this task and check all the checklist items.

  • Upon saving the updated task, you should observe that the task status has been automatically changed to "Completed".

  • Conversely, if you leave at least one checklist item unchecked, the task status will remain "Open" upon saving.

Conclusion

By following these steps, you can leverage InfoLobby's checklist feature and workflow automation to enhance your task management. Feel free to explore and customize the process based on your specific project requirements.

InfoLobby © 2024 Globi Web Solutions