In Architect, use parallel arrays to convert a string value to another value type. Because this solution effectively sets up a key > value mapping, and the specified values are unlimited, it works beyond network-based value types.
For example, a flow contains a string collection variable called Task.QueueNames, and a queue collection variable named Task.Queues. The number of items in both collections is the same. You can configure the variables to quickly look up the associated queue in Task.Queues for a string value found in Task.QueueNames.
Use an Update Data action to configure the collections set on these variables:
Task.QueueNames | Task.Queues |
---|
“Sales” | Genesys Cloud sales queue |
“Marketing” | Genesys Cloud marketing queue |
“Technical Support” | Genesys Cloud technical support queue |
Next, build an expression to perform the lookup and has a fallback default queue if the system cannot find the string supplied for the lookup conversion. To begin, set Task.DefaultQueue to the Genesys Cloud Operator queue for this organization.
Now, build the expression that looks up the queue by name and returns the queue associated with that string:
If(FindFirst(Task.QueueNames, Task.QueueNameStr)!=-1, Task.Queues[FindFirst(Task.QueueNames, Task.QueueNameStr)], Task.DefaultQueue)
Now, you can map string values to queues in a call flow. The expression above works for collections that have a small number of items. For larger collections, save the value from the FindFirst call to a variable, which ensures the system does not execute the call twice in the same expression. If you save the value of the FindFirst call to a Task.FoundIndex integer variable, rewrite the above expression as:
If(Task.FoundIndex!=-1, Task.Queues[Task.FoundIndex], Task.DefaultQueue)