Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

7 Commits

Folders and files

Repository files navigation

TASK_FLOW_COUNTER – Flow Documentation (v1.0.0)

Flow name: TASK_FLOW_COUNTER
Flow type: Inbound Call (type: inboundcall)
Description: Tracks how many times a flow is used by checking a data table for the flow name. If found, increments usage and updates timestamp. If not found, inserts a new row. Designed as a reusable task that can be added to any Architect flow.

This flow’s purpose is to keep a usage counter for flows (or other objects) in a Genesys Cloud Data Table named:

FLOW_USAGE_TRACKING

Every time the logic runs, it:

  1. Sets the flow name to track.
  2. Looks up that flow in the FLOW_USAGE_TRACKING data table.
  3. If a row exists, it:
    • Reads the existing UsageCount.
    • Increments it by 1.
    • Updates the row via a data action (UpdateFlowUsageRow).
  4. If a row does not exist, it:
    • Starts UsageCount at 0 (then increments to 1).
    • Inserts a new row via a data action (InsertFlowUsageRow).
  5. In both cases, it stores the current UTC timestamp as a string (LastUsedText).

1. Dependencies

1.1 Data Table: FLOW_USAGE_TRACKING

From the manifest:

  • Data table name: FLOW_USAGE_TRACKING
  • Referenced in action: Data Table Lookup

Expected columns:

  • Key column:
    • flowName — used as lookup key
  • Data columns:
    • UsageCount — integer count
    • LastUsedText — string timestamp

Column names must match those required by your Data Actions.


1.2 Data Actions

Data Action 1 – InsertFlowUsageRow

Inputs:

  • flowName ← Task.FlowName
  • usageCount ← Task.NewUsageCount
  • lastUsedText ← Task.LastUsedText

Data Action 2 – UpdateFlowUsageRow

Inputs:

  • flowName ← Task.FlowName
  • usageCount ← Task.NewUsageCount
  • lastUsedText ← Task.LastUsedText

2. Tasks in the Flow

2.1 Task: IncrementFlowUsage

  • This is the initial sequence (initialSequence)
  • Contains only a Disconnect action
  • Simple wrapper / entry point

2.2 Task: TASK_FLOW_COUNTER

  • Contains the core counter logic
  • Handles variables, lookup, increments, inserts/updates

3. Variables (Inside TASK_FLOW_COUNTER)

Variable Name Type Input? Output? Purpose
Task.FlowName String No No Name of the flow being tracked
Task.UsageCount Integer No No Value read from data table
Task.NewUsageCount Integer No No UsageCount + 1
Task.LastUsedText String No No UTC timestamp string
Task.flow String No No Copy of FlowName

None of these are marked as input/output.
A reusable-task version would expose FlowName as input.


4. Action-by-Action Logic

1. Update Data (Start Action)

  • Sets Task.FlowName = "TASK_FLOW_COUNTER"
  • Sets Task.LastUsedText = ToString(GetCurrentDateTimeUtc())

2. Data Table Lookup – FLOW_USAGE_TRACKING

Lookup key:

  • lookupKeyValue = Task.FlowName

Outputs:

  • UsageCount → Task.UsageCount
  • LastUsed → unused

Paths:

  • Found → Action (5)
  • Not Found → Action (3)
  • Failure → End task (7)

3. Update Data (Not Found)

  • Task.UsageCount = 0
  • Task.LastUsedText = ToString(GetCurrentDateTimeUtc())

4. Call Data Action – InsertFlowUsageRow

Inputs:

  • flowName = Task.FlowName
  • usageCount = Task.NewUsageCount
  • lastUsedText = Task.LastUsedText

5. Update Data (Found)

  • Task.NewUsageCount = Task.UsageCount + 1
  • Task.flow = Task.FlowName
  • Task.LastUsedText = ToString(GetCurrentDateTimeUtc())

6. Call Data Action – UpdateFlowUsageRow

Inputs:

  • flowName = Task.FlowName
  • usageCount = Task.NewUsageCount
  • lastUsedText = Task.LastUsedText

7. End Task


5. High level of task

flowchart TD
    A[Start Task: TASK_FLOW_COUNTER] --> B[Init task data]
    B --> C[Lookup row in FLOW_USAGE_TRACKING]

    C -->|Found| D[Prepare updated usage count]
    C -->|Not Found| E[Prepare new row with usageCount = 1]


    D --> F[Call UpdateFlowUsageRow]
    E --> G[Call InsertFlowUsageRow]

    F --> H[End Task: Continue Call Flow]
    G --> H

    Continue_Flow_on_Failure
Loading

6. Compact Mermaid Diagram

flowchart TD
    A[Start] --> B[Set FlowName and LastUsedText]
    B --> C[Lookup FLOW_USAGE_TRACKING by FlowName]

    C -->|Found| D[Increment UsageCount<br/>NewUsageCount = UsageCount + 1]
    C -->|Not Found| E[Initialize UsageCount = 0]

    D --> F[UpdateFlowUsageRow]
    E --> G[InsertFlowUsageRow]

    F --> H[End]
    G --> H
    C -->|Failure| H
Loading

7. Summary

What it does:
Tracks how many times a flow has been executed and stores a UTC timestamp.

Where data is stored:
Genesys Cloud Data Table FLOW_USAGE_TRACKING

How it stores:

  • Inserts new rows when none exist
  • Updates existing rows
  • Timestamp updated each run

Key logic notes:

  • FlowName is hard-coded here
  • NewUsageCount = UsageCount + 1
  • Timestamp always refreshed

Implementation into an existing flow

  1. Open Inbound Call flow 'TASK_FLOW_COUNTER'
  • Under Reusable Tasks, you will see a 'TASK_FLOW_COUNTER'
  • Click the Kebab Menu, and select copy. (You do not need to edit the flow to copy the task).
  • Open the Flow you want to add the counter too, edit it.
  • Under Reusable Tasks there is a '+ Task' button, next to it is a Kebab Menu, find the 'TASK_FLOW_COUNTER' in the drop-down list, this will add it to the Reusable Tasks section.
  1. Edit the Task
  • Select the Update Data Block that has 4 variables in it. (Task.FlowName, Task.UsageCount, Task.NewUsageCount, Task.LastUsedText)
  • In the Task.FlowName, set the 'Value to Assign 1" to the name of the flow you are adding the task too. I'd recomend using snake case format.
  • The other 3 variables should not be changed.
  1. Edit the Flow
  • After the Start block of the call flow, add a 'Call Task" block and add the task 'TASK_FLOW_COUNTER'
  1. Publish the flow

Attached JSON Files

Both can be imported into your data actions, you will need to include your Data Table UUID that needs to be created and is referenced as a dependency in section 1.1

  • UpdateFlowUsageRow.json
  • InsertFlowUsageRow.json
"config": {
    "request": {
      "requestUrlTemplate": "/api/v2/flows/datatables/<DATA_TABLE_UUID>/rows/${input.flowName}",

Reference Screenshots

Screenshot 2025-11-26 at 12 54 07 PM Screenshot 2025-11-26 at 12 54 22 PM Screenshot 2025-11-26 at 12 54 51 PM Screenshot 2025-11-26 at 12 55 21 PM Screenshot 2025-11-26 at 12 56 41 PM

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors