Splitting users and persons


Typically we use the data item User for storing properties of our users. This is convenient: all user-properties are in the same place.

But there are some disadvantages to this setup:

  1. Maybe not all persons using the application need a user account. Think of one-time-only webshop customers or contact persons of a CRM system.

  2. You cannot “take over“ a user account to see what the user sees (because you need the login credentials of the customer or employee for that). This can make it difficult to help users without sharing a screen.

  3. Changing the email address of a user is complicated: first create a new user. Then all data and references of the old user must be copied to the new one and the old user must be blocked. Then the data and references of the old user must be cleared.

The solution is to create a data item Person that will be linked to the user. Now:

  1. The person only gets a user account when he needs to be able to login.

  2. A supporting user can take over the account of the person he is helping. This way he can see and do exactly what this person can see and do.

  3. The person can change his email address easily: create a new user, link the person to the new user and block the old user. The person gets a new activation mail and from then on he can use his new email to sign in.

Step 1: create the data item Person

  1. Save the current version.

  2. Create data item Person.

  3. Add a 1-1 reference to User. Name it My account, in data item User, name it Person that owns the account. When a person is taken/taking over, the owner of the account is stored here temporarily.

  4. Add another 1-1 reference to User. Name it User, in data item User, name it Person. This reflects the link that normally exists between the user and the person.

  5. Add the properties that you will remove from the data item User.

  6. Create a user flow for Person and include it in Appearance.

Tip: Don’t adjust the related flows yet: after you delete properties from the data item User (see below), Triggre will show you where you have work to do.

Step 2: transfer the data from User to Person

There are two options, depending on how much data you have to transfer.

Option 1

Build a flow part to copy the data from User to Person. This option is our favorite, because all data stays within the application and it saves a lot of hassle.

  1. Create a flow part with a repeat action that copies the data in data item User to the related person. You can find an example of such a flow part below.

  2. Modify the Admin user flow: add a button that triggers this flow part.

  3. Save the current design. In case you need to revert to it.

  4. Publish the design.

  5. Activate the flow part.

  6. Check the data in user flow Persons.

Option 2

Export the data from User and import them in Person. This is the option we don’t advise you to use, because you might end up with a lot of manual actions.

  1. Be sure that you allow import in Person.

  2. Be sure that you have a user flow available from which you can export all user-data that you want to import in Person.

  3. Save the current design. You might need to revert to it.

  4. Publish the design.

  5. Export the user-data.

  6. Adjust the Excel to the design of Person (don’t forget to rename Email to Email [ID] and to rename the sheet to Person).

  7. Import the sheet into Person.

Step 3: delete the transferred properties from the data item User

  1. Save the current version. You are about to remove properties from the data item User. You definitely want to be able to undo these changes if you find out you did something wrong.
  2. Remove the properties in User that you added to Person. This will probably result in broken items in flow parts and user flows.

Step 4: correct the ‘red’ design items

Check the designer for red dots.
Designer red dots

Correct the items with red dots.
Identify red dots

An example: you transferred First name from User to Person. Now the flow part that generates the full name lacks some data.

Input error

Input error fixed

After making all the changes, save the current version and publish the design.

Example of the transferring flow part

Create the flow part

Flow part creation

  1. Add a look-up of all users.
  2. Add a repeat action, based on the look-up.

Design the repeat action

Repeat action overview

  1. Create the related person.

  2. Copy all properties of the user to this person.

  3. For every referenced property, add a look-up list. Example: invoices.
    Look-up list

  4. Store the person in all these invoices:
    Invoices selection
    Store the person

Which email to use?

Since the email will be available in both User and Person, you have to decide which one you will use in user flows and flow parts. Both should be identical. We advise you to use Email in Person, because when you have persons in your system without a user account, only the Email in Person is available.