Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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:

...

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

Widget Connector
width900
urlhttps://www.youtube.com/watch?v=lfpO9uhAEQ0&list=PLbPt6SI1Zhb_n3lXboTC_Qzq0Kg2x8LtT&index=17
height500

Complete configuration of the invoice generation process in your app. To recap the steps in the video:

  • Create a stream Invoices, by creating a stream from the hover menu on the stream Contacts
  • Set the period of the stream to Transactional
  • Drag all attributes from Contacts into Invoices
  • Drag all attributes from Invoice Transactions into Invoices
  • Create a dashboard Invoices to show invoices: add a grid view including all attributes from the stream Invoices, and hide the UID field
  • Create a custom action that will take users from the intermediate stage of the process to the invoices screen (the intermediate dashboard is backed by the stream Invoice Transactions):
    • Open the configuration form for the stream Invoice Transactions, and add an action:
      • Name: Complete invoice creation
      • Display Name: Complete invoice creation
      • In the Action Completion section:
        • Tick Close Parent Dashboard; in this case the parent dashboard will the be intermediate dashboard, used to assign transactions to a contact, so we want to close this when the user goes to complete the process
        • Tick Open Post Dashboard, and drag in the dashboard Invoices to create a dashboard rule
      • Open the section Context Parameters:
        • Tick Include Previous Context Parameters - this will bring forward any context parameters from the previous dashboard, in this case UID
        • Add new context parameters, to capture new details from the intermediate dashboard - these are details of the chosen transaction
          • First, get the dashboard element name of the grid view of transactions from the intermediate dashboard (Assign Transactions)
          • Use this to set the expression for each context parameter as: [dashboard element name of transactions in Assign Transactions].[View attribute name]
          • Do this for:
            • SKU
            • TransValue
            • TransDate
  • Add a button to the intermediate dashboard (Assign Transactions) to complete the generation of an invoice:
    • Call the button Complete invoice creation
    • Find the custom action under the stream Invoice Transactions, and drag it on to the button to set the custom action
    • Update the button label to Complete Invoice Creation
  • Complete configuration of the stream Invoices, in the model view:
    • Make the stream Contacts static; this will stop this stream being run when the stream Invoices is run
    • Open details for the pipe that connects Contacts and Invoices
      • Set Data To Read = All; after you added importing of contacts from files into the contacts app, there are multiple runs in the Contacts stream, and this setting ensures that we can get all contacts down the pipe
      • Create a filter on the pipe:
        • UID = _context.UID (don't forget to press ABC)
    • Open the configuration form for the stream Invoices, and set the expressions for SKU, TransDate and TransValue, in each case using the expression: _context.[context parameter name]
  • Create a task plan, Complete invoice creation, to run the Invoices stream
  • Complete configuration of the custom action Complete invoice creation:
    • Tick Run Selected Task Plan, and drag in the task plan Complete invoice creation to create a task plan rule
Panel
titleAction summary

In summary, our custom action to complete invoice creation now:

  • Brings forward the UID context variable from the previous dashboard (because we have set Include Previous Context Parameters)
  • Sets three new context variables to capture details of the chosen transaction from the intermediate dashboard
  • Starts a task plan to update the stream Invoices with an analysis run
  • Closes the parent dashboard (Assign Transactions)
  • Opens the Invoices dashboard
  1. Add a filter to the Invoices dashboard to show only invoices for the currently selected user:
    • From the grid view in the Invoices dashboard, open the dashboard element details
    • Add a background filter:
      • UID = _context.UID (don't forget to press the ABC button)

Open the Contacts app, and go into App Mode. Press Create Invoice. In the intermediate step, select a transaction, then press Complete Invoice Creation. You should see details for a new invoice, for the contact you chose on the Contacts dashboard, and the transaction you chose on the Assign Transactions dashboard.


Note

An alternative method of implementing the final step of the workflow would be, instead of running analysis to update the Invoices stream, create an Insert action on the Invoices stream. From the intermediate step, you would need to pass up all details needed to populate an invoice record - including any contact fields required. Then you would associate this action with the button on the intermediate dashboard that completes the invoice creation process.

Which method you choose is a design decision based on the the data set you are dealing with, and the process you are trying to implement. If, for example, the final step of creating invoices involves a lot of rules which are easily implemented in analysis - such as enriching the data through lookups, then the method we have used here would be best.

However, if the creation of invoices involved no additional logic, using an insert action is probably easier to implement. If you have time, try and create invoices using this alternative method.


Panel

Next chapter: 15. Controlling access to apps