I don't want users to opt-in and provide consent. Instead, I want to set a global variable based on the workstream redirected. For example, if the sales team answers the call, post-call surveys should not trigger. However, if the customer service team answers, post-call surveys should be triggered.
I have added this global variable at the workstream level. Within the bot, I try to set its value, but when the call is transferred to post-call surveys, I cannot read the previously set value.
You're on the right track using a global variable to control post-call survey triggering in Omnichannel for Customer Service. However, directly setting and reading global variables from within a bot in the way you're describing isn't the standard approach. Global variables in Omnichannel are typically managed at the workstream level and are used for routing and other workstream-specific logic, not directly for bot control flow.
Here are the correct ways to achieve what you're trying to do:
1. Context Variables (Recommended):
The best way to control survey triggering based on bot interactions is to use context variables. These are variables that are specific to the conversation context and can be passed between the bot and the workstream.
surveyConsent
). Set its value based on the user's interaction in the bot (e.g., if they opted in for a survey). You can use Power Automate to set this context variable or using the code in the bot itself.surveyConsent
)2. Using Power Automate (Alternative):
You could use Power Automate to manage the survey triggering logic.
Why Not Global Variables Directly?
Global variables in Omnichannel are primarily used for:
They are not designed to be dynamically set and read by bots during a conversation's flow. Context variables are the correct mechanism for this type of scenario.
How to Implement Context Variables:
The specific implementation details will depend on the bot framework you're using (e.g., Power Virtual Agents, Azure Bot Framework). Consult the documentation for your bot platform on how to set and pass context variables during a handoff to a workstream. The key is to set the context variable in the bot before the transfer and then use that context variable in your workstream's post-conversation survey configuration rules.
By using context variables or Power Automate, you'll have a much more robust and maintainable way to control your post-call surveys based on bot interactions.
André Arnaud de Cal...
292,286
Super User 2025 Season 1
Martin Dráb
231,064
Most Valuable Professional
nmaenpaa
101,156