In this tutorial you will learn how to use a few of workflow actionsteps to make your apps more comfortable and useful.
You will get to know how to for example use attachments in apps and send emails.
We will show this on the example of a work contract creating app.
Add a new spreadsheet with two columns and name it 'contract_data'. In one column put names for the fields from the second column. Second column set as editable.
Add attachments and workflow actions widget. Name these sections: attachments and actions.
Add a spreadsheet section with two columns and name it 'data'. Put email addresses of people who will: set the task- to create the contract, write the contract and accept the final contract version. Hide this section and in 'hide mode' choose 'no data'.
You will need to create three states- 'creating', 'checking' and 'approved'.
- from the start to 'creating' state create action 'send data'
- from 'creating' state create a 'save changes' action returning back to the state
- from 'creating' state to 'checking' drag a 'send' action
- action 'send back to correct' create from 'checking' to 'creating'
- last action drag from 'checking' to 'approved' and name it 'approve'
a) add editors
Add this actionstep on enter to 'creating' state and on enter to 'checking'. In 'creating' as an editor set add the person that will prepare the agreement text and in checking the person who will be checking the contract after that. Use the emails which we've placed in 'data' section.
b) refresh page
Add it to 'save changes' action in post Workflow. Thanks to this the editor creating the contract will be able to add changes without the need to enter the app multiple times - by default after making the action he would return to the main page.
c) set task message
It is an actionstep that allows you to write a short message to your or someone's task. Add this action step in three places: in action 'send data', on enter to 'checking' state and in 'send back to correct' action.
We need to add the displayed message text using the 'concat' formula. This formula allows us to join words written manually with the ones from sections.
If we want to have space between the displayed words we need to put ' ' signs as a space sign.
We want to put the name of the employed person in the message.
d) send mail
Add this actionstep on enter to 'creating' state. It is used for sending emails at set date and/or on set condition. In our situation the email will be sent if the app stays in the 'creating' state after 2 weeks have passed. It would then mean that the editor hasn't finished preparing the contract.
For the mail to be sent we need to fill the 'send mail' fields as shown below.
Adddays() formula is a formula which adds a chosen amount of days to a chosen date. In our case to present date.
Nowutc() formula is a formula that returns present date regardless of user's timezone.
Currentstate() formula return app's current state name.
e) set section editability
This actionstep determines the ability to add or edit given section in this case section with attachments. Add the step on enter to 'creating' state and in options choose section with attachments and type =true in 'Editable'. On enter to 'checking' state do the same and type =false.
Thanks to this the user checking the contract will be able to download files but he won't be able to add or modify any attachments.
Add app creators, save and check how everything works by running the app.