WorkflowDataSource property doesn't work to receive vars in Flows Add-on.

40 views
Skip to first unread message

Jorge Ivan Andres Contreras Pereira

unread,
Nov 12, 2025, 7:04:23 AMNov 12
to google-apps-sc...@googlegroups.com
Hello everyone,

I'm starting to create a script to understand how Google Workspace Flows works. Even though I've enabled the option to allow input variables, I'm not seeing the option to receive that variable. I'm following this tutorial, but it doesn't show me the option to use variables from previous steps [1]. I set the IncludeVariables property to true within the WorkflowDataSource [2]

Has anyone started working with Flows and encountered this issue? Do you have any ideas about this problem, considering I literally copied the sample GAS and installed it?

Thanks for your help,

[1]
image.png

[2]
image.png

--
Jorge Iván Andrés Contreras Pereira
CTO
Phone:+573005539080 Book me: Calendar
Department: Technology Office, zymDev
The content of this email is intended for the person or entity to which it is addressed only. This email may contain confidential information. If you are not the person to whom this message is addressed, be aware that any use, reproduction, or distribution of this message is strictly prohibited. If you received this in error, please contact the sender and immediately delete this email and any attachments.


The content of this email is intended for the person or entity to which it is addressed only. This email may contain confidential information. If you are not the person to whom this message is addressed, be aware that any use, reproduction, or distribution of this message is strictly prohibited. If you received this in error, please contact the sender and immediately delete this email and any attachments.

Kildere S Irineu

unread,
Nov 16, 2025, 5:27:21 PM (13 days ago) Nov 16
to google-apps-sc...@googlegroups.com

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.


✅ What the docs say

  • In the quick‑start for “Build a calculator step” the manifest includes your inputs and outputs under workflowElementsGoogle 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.


🧐 What could be going wrong in your particular case

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:

  1. 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", ... } ]

      Google for Developers+1

    • 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.

  2. 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") ) )

      Google for Developers+1

    • 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.

  3. 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.

  4. 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.


🔍 Specific things you can try right now

  • 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”.


🧩 One caveat / possible bug

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  

https://www.linkedin.com/in/kilderesobralirineu/

SMAARTE Group

unread,
Nov 17, 2025, 11:12:16 AM (12 days ago) Nov 17
to google-apps-sc...@googlegroups.com
I created a guide that includes an example.  NoteBookLM helped assemble the guide.  Google Gemini Pro 2.5 and DeepThink helped with the coding.  You too can code with GAS and Google Workspace Flows.  All you need is some AI and the will to implement and test everything.

That said, Google Workspace Flows needs significantly more optionality out of the box.  For example, no variable exists to obtain the sender of an email.  The case study in the guide below came about because it shouldn't be necessary to write hundreds of lines of code just to change the name of a file that Flows moves from an email attachment to Drive, yet it is.



Regards,
Steve Horvath




Kildere Sobral Irineu

Reply all
Reply to author
Forward
0 new messages