Advanced workflow settings

In this tutorial you will learn about using advanced workflow options: action visibility, execution condition, confirmation, error message and actionstep set cell value. 

To show how these work we will create a simple app for group voting.

1. Begin

1.a

Start with creating a new app adding a spreadsheet widget with one cell. In this cell write a matter to vote on e.g.: 'Do you want to change working hours to 9 a.m to 5 p.m' ?

1.b

Add a second spreadsheet and in its first cell write 0 value. Set cell type to 'number' and make the cell editable.

1.c

Add one more spreadsheet section and in first cells of columns A and B write 'votes for' and 'votes against'. Under both of these put 0 value, set cells type to 'number' and set the cells as editable.

Screen_Shot_09-24-18_at_04.00_PM.PNG

Add workflow actions widget.

2.Workflow

2.a

Add a new workflow state 'decision' and a 'send' action from the start to it. Add two more actions:'Yes' and 'No' starting and ending at the decision 'state'. In 'decision' state in 'editor' field choose 'multiple'. This change is needed because otherwise first person to enter the app would take ability to edit away from all of the other users. 

Screen_Shot_09-24-18_at_04.12_PM.PNG

2.b

On enter to 'decision' state add 'set editors' or 'add editors' actionstep. Now in editors field you can type All - then all of your sites users will be able to vote; or choose some of the users and write their emails in cells of section 2 spreadsheet.

Screen_Shot_09-24-18_at_04.19_PM.PNGScreen_Shot_09-24-18_at_04.20_PM.PNG

Set this section as not visible by writing =false in visibility field. 

Screen_Shot_09-24-18_at_04.26_PM.PNG

2.c

With our current workflow settings actions 'yes' and 'no' can be done an infinite amount of times. We want for the summed number of 'yes' and 'no' actions to be equal to the number of voters. In our case we have only two voters and that is why we want for the decision to be made two times. Add another set of 'yes' and 'no' actions and a 'finished' state.

Screen_Shot_09-24-18_at_04.33_PM.PNG

We want for the app to go into 'finished' state after the last voter makes a decision.

2.d

At the moment we have two sets of 'yes' and 'no' actions visible. Before we change that there is one more thing we have to do. It is the 'set cell value' actionstep on enter to 'decision' state. Fill in its options same way as below:

Screen_Shot_09-24-18_at_04.38_PM.PNG

Now, every time a user opens the app the value set at the start to 0 will increase by 1. Thanks to this we can now create conditions for 'yes' and 'no' actions visibility. 

2.e

In first set of 'yes' and 'no' in 'action visibility' field put this formula:

=section2.a1<2

In case you have two voters. In other case replace 2 in formula with your number of voters.

Screen_Shot_09-24-18_at_04.45_PM_001.PNGScreen_Shot_09-24-18_at_04.45_PM.PNG

 In second set put an identical formula and only change the '<' sign to '=':

=section2.a1=2

Screen_Shot_09-24-18_at_04.47_PM_001.PNGScreen_Shot_09-24-18_at_04.47_PM.PNG

3.Vote count

If we want to know how users voted after the voting has finished we will need to increase values in section 3.

Screen_Shot_09-24-18_at_04.50_PM.PNG

 To make it possible we need to add 'set cell value' actionstep in every 'yes' and 'no' action. Fill their fields as shown:

for 'yes' actions:

Screen_Shot_09-24-18_at_04.57_PM.PNG

for 'no' actions:

Screen_Shot_09-24-18_at_05.00_PM.PNG

4.One person- one vote

If we want for the user to vote only once we need to make some more changes in workflow.

4.a

First, add new rows to section 2 spreadsheet - it should  have 6 of them altogether. 4th cell set as editable and leave it empty.

4.b

Go back to workflow tab and to every 'yes' or 'no' action add 'set cell value' actionstep. The cell we will be setting a value for is the empty editable one in section 2. Its value will be a formula which will put a currently voting user email address in the empty cell. In this cell  email addresses will appear after every vote. 

Formula : =CONCAT(section2.a4,CURRENTUSEREMAIL(),';')

Screen_Shot_09-24-18_at_05.15_PM.PNG

4.c

We can use this fact to exclude users who already voted from further voting. We will use the fact that their email addresses are already in the cell.

Put this formula in 5th cell of section 2 spreadsheet:

=find(section2.a4,CURRENTUSEREMAIL())=0

Set type of this cell as 'Checkbox'.

This formula checks if current users email address is already in the cell or not.

Now we need to prevent users who already voted from making any actions. To do so let's put this formula in 'execution condition' field for every 'yes' and 'no' action. 

We can do it by copying the formula and pasting it in every field or by simply writing this cell address :

 =section2.a5

 4.d

Now let's write an error message- it is a message that appears when the execution condition is not met. In our case it is voting for a second time. Let's put this type of message in the last cell of section 2. It can be for example: 'You cannot vote twice.'

mceclip0.png

Next write this cell's address in every 'error message' field for 'yes' and 'no' actions.

=section2.a6

Screen_Shot_09-24-18_at_05.31_PM.PNG

5.Confirmation

The last thing that we can add is a confirmation for 'no' actions. Confirmation in our app is a window that will appear when a user votes 'no'. Choose the confirmation option and in confirmation title write for example: Explain why. We want the person voting against to explain why he or she disagrees.  

Screen_Shot_09-25-18_at_09.32_AM.PNG

6.Test

Lastly, add yourself as the app creator, save the app and run it to test how it works.

Screen_Shot_09-25-18_at_09.35_AM.PNG

Screen_Shot_09-25-18_at_09.35_AM_001.PNG

After trying to vote for a second time:

Screen_Shot_09-25-18_at_09.37_AM.PNG

 

Have more questions? Submit a request

0 Comments

Article is closed for comments.
Powered by Zendesk