Workflow - Possible to use Decision Activity to conditionally display shape?

197 Views Asked by At

I am conditionally displaying additional form fields within a Grid in a Dynamic Form using javascript. So if I have a radio button with Yes/No choices, "Yes" would display a grid (using <div id="whatever">) with additional questions, and "No" would not display the grid.

Now, when sending an E-Mail through a Workflow, I'd like to determine whether or not to show any responses depending on that Yes/No choice in the Dynamic Form. This way, if "No" is selected then there are no answers to those additional questions, and hence the E-Mail will not display them; whereas if "Yes" is selected, those questions are displayed in the E-Mail Activity along with the responses input by the user.

But I am stumped on how to accomplish this.

I started poking around using the Decision Activity, particularly Workflow.SetState();, by setting {Shape.Execute:Shape1} in a variable, but it just passes the literal string instead of executing the shape.

Here is my Decision Activity code:

var choice = "#{FormSubmission.Field:RadioChoice}";
var choiceDisplay = "";

if (choice == "Yes") choiceDisplay = "{Shape.Execute:Shape1}";
else if (choice == "No") choiceDisplay = "{Shape.Execute:Shape2}";

Workflow.SetState("InsertShape", choiceDisplay);
SetOutcome("Done");

And this is how I use it within the E-Mail Activity:

{Workflow.State:SetState}

I am not sure if this would even work. Any guidance is appreciated.

If it is the case that this would not work, how might I go about accomplishing this?

0

There are 0 best solutions below