Script App example: Move Dispatch workers into tags

Script Apps is a powerful feature that allows you to build and manage your own scripted extensions for the VehicleTracker application. You can read more about its capabilities here.

In this guide, we will show how to make the following scenario:

- When a Dispatch worker gets a job assigned

- When the job is in the Active or Dispatched state, the user will be added into a WorkersWithJobs tag.

- When the user has no more jobs assigned or are all completed, the user will be removed from the WorkersWithJobs tag.


This Script App does not remove a user from a tag when the job is completed or the job is eliminated. We leave this app open to further improvement by the user.

Getting started

1. Install the Script App as shown here.

2. Create a Tag for your workers with assigned jobs, do so by clicking in Admin > Tags > + New Tag and create a tag. In our example we will use the tag name WorkersWithJobs

3. Create view for the WorkersWithJobs tags, go to Admin > Views and create a +  New view where you will include the Tag created in step 2. We will call the view in this example WorkersWithJobs

App setup

1. In the application, Go to Developer > App Builder

2. Select + New App

3. Put a Name to your App and select Administrator as the user that will trigger this event. Then click in Save to continue.

4. On each App you can add as many Scripts as necessary to complete the task of this app. In this case we will create a new Script by selecting +New Click Script

5. Put a name to your Click Script and then select Edit to put your code in.

6. Insert the following code

if (job.assignedWorker != null){
if (job.state != 'Unassigned') {

After pasting the code, click in Run Script first, then Save.

7. Now the Click Script editor will look like this. Click in Save again.

Note: the current job states you can handle via Script are:

  • Assigned > A worker exists but the Job has not been dispatched
  • Unassigned > A worker does not exist
  • Active > Worker has started working on the Job
  • Dispatched > A worker exists and the Job has been dispatched
  • Completed > Worker has completed the Job
  • Deleted > Job removed


To test the solution, create jobs for your workers and assign them to any available Worker. If those jobs are in the Assigned or Active state, the users will be added into the Tag WorkersWithJobs as shown in the image.