

|
Great that you’re exploring Google Workspace Flows + Google Apps Script — this is fairly new, and yes, the “receive variables from previous steps” scenario can be a little tricky. Based on what you described and the docs I found, here are a few likely issues and suggested checks/solutions.
In the quick‑start for “Build a calculator step” the manifest includes your inputs and outputs under workflowElements … Google for Developers+1
The “Create a configuration card” guide mentions that in a SelectionInput (and similar) you can set:
"platformDataSource": { "hostAppDataSource": { "workflowDataSource": { "includeVariables": true, "type": "SPACE" } } }
And in that context includeVariables: true allows “the user to select variables of previous steps”. Google for Developers+1
The “Validate an input variable” guide shows how the system expects you to define the workflow’s inputs, outputs, etc. Google for Developers
So yes — the mechanism is supported (at least in documented form) for selecting previous‑step variables as inputs to subsequent steps.
Given that you have “enabled the option to allow input variables” (i.e., set includeVariables = true) but you’re not seeing the option to pick variables from a previous step, here are things to check:
Manifest setup
In your appsscript.json, you need to define workflowElements for your add‑on under "addOns":{"flows":{...}}. The quickstart shows this. Google for Developers+1
Within each workflowElement, you need to define inputs (and optionally outputs) for your action. The variables from earlier steps become selectable only if your action declares inputs that allow variable types. Example from quickstart:
"inputs": [ { "id": "value1", ... }, { "id": "value2", ... }, { "id": "operation", ... } ], "outputs": [ { "id": "result", ... } ]
If the step you created has no declared input (or only “static” input fields not meant for variable selection), then the UI won’t show previous‑step variables as selectable.
Card configuration code matches inputs
In your onConfig… function (you showed part of it), you use something like .setHostAppDataSource(CardService.newHostAppDataSource().setWorkflowDataSource( … )). That is good — you did set includeVariables(true). But you must ensure that the widget you're creating actually uses that dataSource. Example from doc:
.setHostAppDataSource(CardService.newHostAppDataSource() .setWorkflowDataSource(CardService.newWorkflowDataSource() .setIncludeVariables(true) .setType("SPACE") ) )
But crucially: the widget must correspond to an input field defined in the manifest for that action. If it doesn’t map, the variable‑selection UI may not appear.
Selecting variables only appears when it makes sense
The “select variable from previous step” possibility appears in the UI only when there are existing variables produced by prior steps (or by the trigger) that have compatible types. If you only include your “Calculator” step as the first action after the trigger, there may be no prior variables to select yet. Example: if your trigger is simply “When I get an email” (no output variable), then in Step 2 you won’t have previous step variables available to pick.
The docs say: “If the step requires a variable of input, configure includeVariables so the user can select outputs from previous workflow steps.” Google for Developers
So: make sure the trigger (or a preceding step) has defined outputs; or earlier steps produce variables that you can pick in your input widget.
Deployment & versioning / permission issues
The docs remind you: after you update the add‑on script and manifest, you must deploy a new test deployment, install the add‑on, refresh the list of available steps in Flows, then rebuild your flow to pick the updated version. Google for Developers+1
If you had the previous version installed but you changed the manifest, you might be seeing the old version where includeVariables wasn’t set or inputs weren’t compatible. Re‑deploying and reinstalling often fixes these “changes don’t appear” issues.
In your manifest (appsscript.json), check that under "addOns":{"flows":{"workflowElements":[ … ]}} your action has inputs defined for each field you want variable selection on.
Confirm that the widget you created in the config card is tied to one of those input IDs. For instance, if you defined input id: "value1", your TextInput or SelectionInput should use setFieldName("value1").
Ensure that .setHostAppDataSource(...).setWorkflowDataSource(...).setIncludeVariables(true) is present in the widget config, and that the .setType(...) of the workflowDataSource is in line with the variable type you want to select. The docs show “type":"SPACE" as an example for selecting a Chat space. For general variable selection maybe the type differs (or might allow default).
Create a small test preceding step that produces an output variable. Example: a “Get email metadata” step that outputs messageId or something. Then in your calculator step, verify if that output appears as selectable.
Deploy a new version of your add‑on, install it, then in the Flows builder create a new flow (so the updated step appears fresh).
Check the “Activity” or “Logs” tab in the Flows builder after running a flow to see if any errors log about “input variable not found” or “widget data source error”.
I found a post in the Google Apps Script community that exactly matches your issue: “WorkflowDataSource property doesn't work to receive vars …” stating that someone copied the sample and still did not see variable selection. Google Groups So it may be that the feature is still in alpha and occasionally not fully surfaced, or there might be a UI glitch/mismatch in your Workspace domain.
If you suspect a bug, you might:
Try a different Google Workspace account / domain (if possible) to see if the UI appears.
Check if your Workspace domain has the “Flows” feature fully enabled (it's labelled as Gemini Alpha in docs) — if Flows is restricted in your account maybe some features are hidden. Google for Developers+1
Monitor the Google Workspace Developer Release Notes or community forums for any reported “variables not selectable” issues.
--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-apps-script-community/CAGxM__6wvA6wPiM00e2ZrW%2B5%2BZy8guBMs0CXF-x5rPK1Fmqj6g%40mail.gmail.com.
Kildere Sobral Irineu
Analista e Desenvolvedor de Sistemas e Agentes de IA
Administração de Empresas – MBA Gestão
Kildere Sobral Irineu