<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
0D54z000074wF98CAEOkta Identity EngineWorkflowsAnswered2023-06-26T10:55:47.000Z2021-07-26T18:12:37.000Z2021-07-30T21:26:37.000Z

ConanP.47433 (Greenpeace International) asked a question.

How to handle multiple (26) if/else statements without losing my mind

I have set up workflows that will send notifications of changes in account status to a channel in Slack. Pretty straightforward. However, the problem is that our org is divided into 26 semi-independent offices across the world and each one manages their own staff and has their own separate Slack workspace. The accounts are designated by an attribute called primaryOffice.

 

So the workflow is triggered, it checks the primaryOffice of the user to know which office it is from and then sends a notification to a channel in that office's Slack workspace.

 

Currently, I have done this with a separate workflow for each office.

 

I want to do it so that I have a single trigger that then checks the office and either in the same workflow or in a child, sends it to the correct workflow.

 

I basically need the equivalent of a CASE, which Okta claims the if/else is but the gui makes it almost impossible to do this with more than 2, it becomes totally confusing.

 

Basically I want this logic:

IF primaryOffice = Africa THEN send notification to Africa workspace

IF primaryOffice = Asia THEN send notification to Asia workspace

24 more times

 

Can I do this with a table?


  • Hi Conan,

    I might be wrong but that is not possible.

    Today we don't have option to dynamically choose connectors or dynamically call asynchronous flows based on whatever your logic. Such option would definitely make sense and you would be able for example to use table to consolidate all your datas.

    I.e. User's primaryOffice = Africa then lookup Table and search for Connector ID or CallSync ID and use it to send you message appropriately.

    Expand Post
  • TimL.58332 (Workflows)

    Assuming the same Slack connection can access all of the 26 "locations" you should be able to meet your need by using a Custom API Action. You would be able to use a "variable" message destination such as a channel or specific individual as part of the construction of the POST.

     

    See https://api.slack.com/messaging/sending as a primer for utilizing the API directly.

     

    Here is a rudimentary example where you would construct an object containing locations with their respective Slack channel values. You then "get" the location to obtain the value from the key which is utilized in the compose card to message the channel in slack.

     

    Screen Shot 2021-07-27 at 9.53.51 AM 

    Expand Post
  • TimL.58332 (Workflows)

    Also, if "has their own separate Slack workspace." is indicating you need different authentication/authorization for each, you may need to take the above suggestion a step further and utilize a API Connector card to perform RAW requests. If you have a token for each destination you could do similar to above and dynamically generate the Slack requests using different AAA to the different endpoints.

    Expand Post
  • ConanP.47433 (Greenpeace International)

    Thanks, Tim. That is helpful. I was hoping to avoid going the API route (being lazy) but may be the only solution.

     

    Another factor is that the syntax of primaryOffice does not correspond exactly to the actual workspace/channel so there will still need to be mapping done. Can I create a table that maps primaryOffice to workspace/channel in the Workflows that would then populate the object?

    Expand Post
  • TimL.58332 (Workflows)

    So yeah, you could do it as a table but doing it as a Key Pair with Object Construct + Get Object is going to be a lot faster. In the Object Construct card you would set the "Key" value (name of the field) to the value from primaryOffice attribute and the "Field Value" would be the Slack channel. Then in your Get Object card you would "get" the primaryOffice attribute value as the Key value and it returns the "Field Value" which is the mapped slack channel.

     

    The advantage to a native table is if you have multiple flows in the same "Folder" needing access to the same information you don't need to recreate the wheel over and over. If you have access to something like gsheets or smartsheets you could even store the mapping externally and have any flow access it (even slower than native tables)

    Expand Post
This question is closed.
Loading
How to handle multiple (26) if/else statements without losing my mind