Parsware
All articles

How-tos

How to build a complete app: table, app, approval process and report

From an empty environment to a working expense-claims app: a table, a form and a view, an app shared with a role, an approval process and a printable report. Every step of how-to video H001.

A bright cover reading "How-to · H001: Build a complete app", with "From an empty environment" under it, the steps Table → App → Approval → Report, and two screens from the video.

How-to H001 · 10 min 41 s. A complete tutorial: every click, every value and every line of code the video types, so you can build the same app at your own pace. Every picture is a frame of the video.

This is the longest how-to, and the one to start with. You build an expense-claims app in an empty environment, in five parts:

  1. The table: a publisher, a solution, a list of statuses and the Expense Claim table.
  2. The app: a form, a view, a security role and the Expenses app, shared with the people who use it.
  3. The process: an approval that starts by itself when a claim is saved, and gives the manager a task.
  4. The report: a printable list of claims, in the app's navigation.
  5. Run it: an employee raises a claim, and their manager approves it.

Each part also has its own short how-to, linked at the end, if you want to go deeper into one of them.

Before you start

  • An environment with nothing built in it. The video uses one called Expenses.
  • An administrator account, signed in to the Admin Control Center (the maker portal).
  • Two more user accounts, for the people who use the app. The video uses Robin Park, an employee, and Sam Taylor, Robin's manager. Add them under Admin › Users if you don't have two people to hand.

Allow about 30 minutes the first time.

Part 1: The table

1.1 Create a publisher

Everything you build belongs to a publisher, and the publisher's prefix starts every name you create.

  1. In the rail on the left, under Admin, select Publishers.

  2. Select New.

  3. Fill in the panel:

    Field Value
    Display name Fabrikam
    Prefix fab
  4. Select Add.

The prefix can never be changed, because every table and field name is built from it. From now on, the expense table is fab_expenseclaim and its amount field is fab_amount.

1.2 Create a solution

The solution is the package that holds the whole app, so it can be moved to another environment later.

  1. Select Solutions in the rail, then New.
  2. Type the display name Expense Claims.
  3. Under Publisher, pick Fabrikam (fab_).
  4. Select Save.

The solution opens on its Overview, and the rail changes to the solution's own menu: Tables, Option Sets, Forms, Apps, Processes, Reports and the rest. Everything from here on is done inside this solution.

1.3 Make the list of statuses

A claim is Submitted, Approved or Rejected. A fixed list like that is an option set, and it has to exist before a field can use it.

  1. In the solution's rail, select Option Sets, then New.
  2. Type the display name Claim Status.
  3. Under Options, type the first label, Submitted, and select the colour square beside it. Pick amber.
  4. Select Add option, type Approved and pick green.
  5. Select Add option, type Rejected and pick red.
  6. Select Save.
Label Colour
Submitted Amber #f59e0b
Approved Green #22c55e
Rejected Red #ef4444

Each option gets a number when you save, taken from your publisher's range (for example 270200000, 270200001 and 270200002). Open the option set again and note the three numbers: the process scripts in Part 3 use them. Yours depend on your publisher, so they may differ from the video's.

1.4 Create the table

  1. Select Tables, then New.
  2. Type the display name Expense Claim. The logical name fills itself in as fab_expenseclaim. It can't be changed after you save, so check it now.
  3. Type the plural name Expense Claims.
  4. Select No icon, type receipt in the search box and pick the Receipt icon.
  5. Select Save.

The table opens on its Fields. It already has Name (fab_name), the primary field that labels every claim.

1.5 Add the fields

  1. Select New. The New field panel opens.
  2. Add the four fields below. After each one, select Save & New, which saves the field and opens the panel again. After the last, select Save.
Display name Logical name Data type Settings
Amount fab_amount Decimal Tick Required
Expense Date fab_expensedate Date/time Default control: Date (no time)
Status fab_status Option set Option set: Claim Status
Description fab_description Multiline text

Check it: the Fields list shows Name, Amount, Expense Date, Status and Description, each with its own data type.

Part 2: The app

2.1 Put the fields on the form

Every table starts with a form called Information. A new field isn't placed on it by itself.

  1. In the table, select Forms and open Information.
  2. From Available fields on the left, drag Amount, Expense Date and Description into the General section, under Name.
  3. Drag Status into the header band at the top (the box that says Drag a field here), so it shows beside the claim's name on every tab.
  4. Select Status in the header and tick Read-only. Nobody types the status: the approval process sets it.
  5. Select Save.

2.2 Set up the view

The view is the list people work in.

  1. Select Views and open All Expense Claims.
  2. Drag Created By, Amount, Expense Date and Status into the view's columns, after Name.
  3. Select Save.

2.3 Create a security role

A role says what its people may do with each table.

  1. Go back to the solution, select Roles, then New.
  2. Type the display name Expense User and select Save. The role opens on its permissions.
  3. On the Expense Claims row, set Create, Read and Update to Every record.
  4. Select Save.

2.4 Create the app

  1. In the solution, select Apps, then New.

  2. Fill in the panel:

    Setting Value
    Display name Expenses
    Takes part in business processes Ticked. This gives the app's users a My Tasks list, which the manager needs in Part 5.
    Group 1 title Claims
    Group 1 tables Select Add table to group 1 and pick Expense Claim (fab_expenseclaim).
    Home page Expense Claim
  3. Select Add.

2.5 Share the app and give people the role

An app opens only for the roles it is shared with.

  1. In the Apps list, tick Expenses and select Share.
  2. Tick Expense User and select Save.
  3. In the rail, under Admin, select Users and open Robin Park.
  4. Select Manage roles, type Expense in the search box, tick Expense User and select Save.
  5. Do the same for Sam Taylor.

Part 3: The approval process

3.1 Create the process

  1. In the solution, select Processes, then New.
  2. Type the display name Expense Approval and the description A manager approves or rejects each expense claim.
  3. Select Save.
  4. Tick Expense Approval in the list and select Design.

3.2 Make the manager's buttons (the coform)

A coform is what a person sees when they finish a task. Its outcomes are its buttons.

  1. In the designer, open Coforms and select New.
  2. Type the display name Approve claim. Its logical name becomes fab_approveclaim.
  3. Under Outcomes, fill in the first row: value approved, label Approve.
  4. Select Add outcome and fill in the second row: value rejected, label Reject.
  5. On the Reject row, set the style to Destructive and tick the box that makes a comment required, so nobody rejects a claim without saying why.
  6. Select Save.
Value Label Style Comment
approved Approve Normal Optional
rejected Reject Destructive Required

3.3 Name the lanes

  1. Go back to Flow, and select the full-screen button at the top right of the canvas, to give yourself room.
  2. Select each lane's name and rename it. Press Enter after each one:
    • Lane 1 → Employee
    • Lane 2 → Manager
    • Lane 3 → System
  3. With the System lane selected, set its Height to 280, so the two script steps fit.

3.4 Draw the steps

Drag each shape from the toolbar into its lane. After each drop, type its Title in the properties panel and press Tab.

Shape Lane Title Type
Start Employee Claim submitted
Task Manager Approve claim User (a person does it)
Task System Mark approved Script
Task System Mark rejected Script
Finish System Done

3.5 Connect them

  1. Select Connect in the toolbar.
  2. Drag from each step to the next:
    • Claim submitted → Approve claim
    • Approve claim → Mark approved
    • Approve claim → Mark rejected
    • Mark approved → Done
    • Mark rejected → Done
  3. Press Escape to stop connecting.
  4. Open View and select Auto arrange to tidy the diagram.

The process designer showing Expense Approval: Employee, Manager and System lanes, a Claim submitted start, the Approve claim task and the steps that mark the claim approved or rejected.

3.6 Set up the manager's task

Select Approve claim and fill in its properties:

Property Value
Coform fab_approveclaim (Approve claim)
What they look at The record's form
App Expenses
Table Expense Claim
Assigned to the code below
Record the code below

Assigned to says who gets the task. Select the row to open its code editor and type:

user("Sam Taylor")

Record says which claim the task is about: the one that started the run.

getRecordRef("record")

getRecordRef("record") is the record the process was started for. You will use it in every script below.

3.7 Say which way each button goes

Each connection out of Approve claim is taken when one of the coform's buttons is pressed.

  1. Select the connection from Approve claim to Mark rejected. Set Taken when to Reject and type the title Rejected.
  2. Select the connection to Mark approved. Set Taken when to Approve and type the title Approved.

3.8 Write the scripts that record the decision

A Script task runs BS Lang, the platform's scripting language, with nobody involved. Each one writes the decision onto the claim.

Select Mark approved, open its On enter code row and type the following. Use the Approved value you noted in step 1.3:

updateRecord("fab_expenseclaim", getRecordRef("record"), { "fab_status": 270200001 })

Select Mark rejected, open its On enter row and type the following, with your Rejected value:

updateRecord("fab_expenseclaim", getRecordRef("record"), { "fab_status": 270200002 })

updateRecord(table, record, values) changes the fields you name on one record and leaves the others alone. An option-set field takes the option's number, never its label, so renaming an option later doesn't break the script.

3.9 Say when it starts

  1. Select the process itself (Expense Approval at the top of the outline on the left).
  2. Change Nobody — it is started by hand to A record is created.
  3. Under Choose a table, pick Expense Claim.
  4. Open the On start code row and type the following, with your Submitted value, so a new claim is marked Submitted the moment it is saved:
updateRecord("fab_expenseclaim", getRecordRef("record"), { "fab_status": 270200000 })

3.10 Check, save and publish

  1. Look at the problems panel. It should say Nothing wrong with this process. If it lists a problem, select it to go to the step it's about.
  2. Leave full screen, and select Save.
  3. Select Publish. The designer says Published as version 1.

From now on, every claim anyone saves starts a run and goes to Sam.

Part 4: The report

4.1 A saved query

A report reads its rows from a saved query.

  1. In the solution, select Saved Queries, then New.
  2. Type the display name Expense claims and, under Table, pick Expense Claim.
  3. Leave the columns empty: with no columns picked, the query returns them all.
  4. Select Save.

4.2 The report and its dataset

  1. Select Reports, then New.
  2. Type the display name Expense claim.
  3. Under the dataset's saved query, pick Expense claims.
  4. In the record field, type id. This lets the report print one claim from that claim's own form, as well as all of them.
  5. Select Save.

4.3 Design the page

  1. Tick the report and select Design.
  2. Open Insert and select Report page. This adds a page with a header, a row that repeats once per claim, and a footer.
  3. Select the first text in the repeating row (in the video it is Text 24 in the layers list). On the Report tab, bind it to row.fab_name.
  4. Select the second text (Text 25). Bind it to row.fab_amount and set its format to currency.
  5. Select Save.

4.4 Share it and put it in the app

  1. Go back to Reports, tick Expense claim, select Share, tick Expense User and select Save. A report runs only for the roles it is shared with.
  2. Select Apps, tick Expenses and select Edit.
  3. Select Add report to group 1, pick Expense claim and select Save.

The app is built.

Part 5: Run it

5.1 The employee raises a claim

  1. Sign in to the environment's own address (the Open button beside the environment on Home gives it) as Robin Park. The Shell shows the one app shared with Robin: Expenses.
  2. Open it, and select New.
  3. Fill in an amount, a name (the video uses Taxi to client meeting), the date of the expense and a description.
  4. Select Save & Close.

Saving the claim started the approval, so its Status already reads Submitted.

5.2 The manager approves it

  1. Sign out, and sign in as Sam Taylor. Open Expenses.
  2. The tray at the top shows a task waiting. Open My Tasks.
  3. Select the task and choose Open. The claim opens read-only, with the task's bar along the bottom.
  4. Select Decide, then Approve.

An expense claim, Taxi to client meeting, open in the Expenses app with status Submitted and a Decide button for the Approve claim task.

Refresh the page. The status now reads Approved, written by the Mark approved script.

5.3 Print the claims

The report is in the app's navigation, under Claims. Open Expense claim, and every claim is laid out on a printable page.

The expense claim report in the app's report viewer, ready to print.

If something goes wrong

  • Robin sees no app. The app isn't shared with Expense User, or Robin doesn't have the role. Check step 2.5.
  • The status stays empty after saving. The process isn't published, or its trigger isn't on Expense Claim. Open it in the designer and check steps 3.9 and 3.10.
  • The status is set to the wrong value, or the script fails. The number in the script isn't one of your Claim Status options. Open the option set, copy the right number and publish the process again.
  • Sam has no My Tasks. The app isn't ticked Takes part in business processes (step 2.4).
  • The report says you can't run it. It isn't shared with a role Sam has (step 4.4).

What you built

Part What it is Its name
Publisher Who owns the work, and the prefix Fabrikam, fab
Solution The package that holds it all Expense Claims
Option set The list of statuses Claim Status
Table One row per claim fab_expenseclaim
Role What its people may do Expense User
App Where people work Expenses
Process The approval, with a task and two scripts Expense Approval
Report The printable list Expense claim

A claim is raised, it reaches the right person, the decision is written back on the record, and the paperwork prints. The next how-tos take each part further: a process with a branch in H002, a phone app on the same table in H003, and moving the finished solution to Test and Production in H005.

Read more

Is there a task you would like to see done step by step? Tell us. parsware.com/contact