In this chapter we will create a simple workflow, to create invoices for a chosen contact. This uses many of the features of app building you have used up to this point, and adds a new feature - context variables - which are crucial as you take users from one screen to another in a workflow.
Intermediate step: assign transaction to contact
In this exercise, we will create the intermediate step of the workflow, where the user can assign a transaction to a chosen contact. In the exercise you will need a sample file of transactions. You can download the file here:
Create this first step of the workflow in your app. To recap the steps in the video:
- Add a file collector to your model, call this
Invoice Transactions
- Upload the test file Invoice Transactions.xlsx to configure the file collector and create a stream
- Load the list of invoice transactions
- Create a new dashboard
Assign Transactions
- Add two views to the dashboard:
- In the top half, create a form called
Contact Details Assign Trans
- Open the configuration form for the stream
Contacts
, and drag on all attributes on to the form - Hide the
UID
field, and re-arrange the fields on the form - don't forget about the layout options on forms under [right click] → Arrange the selected items - Create a grid view in the bottom half, from the stream
Invoice Transactions
, including all attributes from the stream
- In the top half, create a form called
- Create an action on the
Contacts
stream - we will use this to initiate the invoice creation process from theContacts
dashboard:- Name:
Start invoice creation
- Display Name:
Start invoice creation
- In the section Action Completion:
- (We will not tick Close Parent Dashboard - in this case, the parent dashboard is the
Contacts
dashboard, and we want to leave this open) - Tick Open Post Dashboard, then Apply
- Drag in the dashboard
Assign Transactions
to create a dashboard rule
- (We will not tick Close Parent Dashboard - in this case, the parent dashboard is the
- Open the section Context Parameters
- Create a new context parameter:
- Name:
UID
- Expression:
_form.UID
- This will take the value of UID from the currently select contact in the
Contacts
app, and save it to a context variable; we can then use this value at the next stage of the process
- Name:
- Name:
- Add a button to the
Contacts
dashboard to start the invoice process - Call the button:
Create Invoice
- Associate the custom action
Start invoice creation
with the button - Update the button label to
Create Invoice
- Apply a filter to the contact form in the dashboard
Assign Transactions
to show the selected contact:- Right click on the contact form in the dashboard, and go to Dashboard Options → Show Element Details
- In the element details, add a background filter:
- Name:
by UID
- Condition:
UID
=_context.UID
(don't forget to make the condition an expression, by pressing the ABC button)
- Name:
Open the Contacts
dashboard, and go into App Mode. Select a contact, and press the Create Invoice
button - this will take you to the Assign Transactions
dashboard, with details for the selected contact shown.
Final step: create invoice