Open ynkze opened 2 months ago
I am trying to understand what you are trying to accomplish, is the following correct?
If the above is accurate, that's not possible at this time (at least not in the "nice" way you've described it) - though we are actively planning on adding support for this feature in the coming months. The main reason is that Workflow configurations are static and resolved at deploy-time. That is, the specific setup for the OpenForm step is defined statically and in whole via the app manifest. If you run slack manifest
and inspect the contents of the workflows
property in the outputted JSON, you will see the entire workflow configuration defined there.
A workaround in the mean time is to build your own form using the available interactivity features in the deno SDK. You can build a full interactive modal yourself, using all Block Kit elements available within Modals (specifically the Input block). There is one Block Kit element in particular, the externally-sourced select menu, that you can build a form in a modal with that should meet the use case you describe. Custom steps can register a 'block kit suggestion handler' to run some code at runtime whenever the externally-sourced select menu is typed into.
I have a sample app on GitHub that shows off building a full interactive modal flow using the deno-slack-sdk: https://github.com/filmaj/interactive-approval
It's an example 'approval flow' app that posts a message with an approve and a deny button. If the end-user clicks deny, it will open a fully-featured modal and implements its own form. One of these form fields is an externally-sourced select menu; in this example app it reads from a bundled .csv file to provide dynamic options in this select menu.
Hope that helps!
Thanks for the detailed reply! What you described is exactly what I need to work with, specifically I didn't know that workflows does not have the ability to resolve dynamic values, so the interactive modal looks like a good workaround. If this feature gets implemented that's great, but in the meantime I will try the interactive modal.
Question
For instance, typically you provide some enum values in the form options:
Instead of
["one", "two", "three"]
, I have afetchName
from datastore function to get an array of names because the names might change so I do not want hardcoded enums. However forWorkflow
I am not allowed to add a step beforeOpenForm
because of the following problem:This means that I can't invoke any function via
addStep
prior to the form, is there a workaround?