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:
- Sets the flow name to track.
- Looks up that flow in the FLOW_USAGE_TRACKING data table.
- If a row exists, it:
- Reads the existing UsageCount.
- Increments it by 1.
- Updates the row via a data action (UpdateFlowUsageRow).
- If a row does not exist, it:
- Starts UsageCount at 0 (then increments to 1).
- Inserts a new row via a data action (InsertFlowUsageRow).
- In both cases, it stores the current UTC timestamp as a string (LastUsedText).
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 countLastUsedText— string timestamp
Column names must match those required by your Data Actions.
Data Action 1 – InsertFlowUsageRow
Inputs:
flowName← Task.FlowNameusageCount← Task.NewUsageCountlastUsedText← Task.LastUsedText
Data Action 2 – UpdateFlowUsageRow
Inputs:
flowName← Task.FlowNameusageCount← Task.NewUsageCountlastUsedText← Task.LastUsedText
- This is the initial sequence (initialSequence)
- Contains only a Disconnect action
- Simple wrapper / entry point
- Contains the core counter logic
- Handles variables, lookup, increments, inserts/updates
| 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.
- Sets
Task.FlowName = "TASK_FLOW_COUNTER" - Sets
Task.LastUsedText = ToString(GetCurrentDateTimeUtc())
Lookup key:
lookupKeyValue = Task.FlowName
Outputs:
UsageCount→ Task.UsageCountLastUsed→ unused
Paths:
- Found → Action (5)
- Not Found → Action (3)
- Failure → End task (7)
Task.UsageCount = 0Task.LastUsedText = ToString(GetCurrentDateTimeUtc())
Inputs:
flowName = Task.FlowNameusageCount = Task.NewUsageCountlastUsedText = Task.LastUsedText
Task.NewUsageCount = Task.UsageCount + 1Task.flow = Task.FlowNameTask.LastUsedText = ToString(GetCurrentDateTimeUtc())
Inputs:
flowName = Task.FlowNameusageCount = Task.NewUsageCountlastUsedText = Task.LastUsedText
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
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
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
- 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.
- 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.
- Edit the Flow
- After the Start block of the call flow, add a 'Call Task" block and add the task 'TASK_FLOW_COUNTER'
- Publish the flow
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.jsonInsertFlowUsageRow.json
"config": {
"request": {
"requestUrlTemplate": "/api/v2/flows/datatables/<DATA_TABLE_UUID>/rows/${input.flowName}",