Click Scripts: User Right Click Menu
Click scripts can be executed from the User right-click menu. You can combine multiple actions commonly used together into one, e.g. adding a user to a tag while removing it from other tags.
Enabling and creating click scripts
Details on enabling and creating click scripts can be found here.
Create a new click script by choosing Development > App Builder > Add new Click Script (in the Click Scripts section).
To create click scripts shown in the user right-click menu, select the UserRightClickMenu type in the Edit Click Script form. In this case, the Enabled option determines whether the script will be listed in the right-click menu for eligible users.
Apart from this, you can control which roles get to use which scripts by restricting the access to scripts listed under the _UseClickScript privilege for that role. To be able to immediately see the changes to the interface after you create a script, make sure that this privilege is enabled for the role with the edit privilege.
Example: moving a user between tags
Create three tags named, for example, First, Second, and Third. Let us suppose that only one of these tags should be assigned to a user at a time. When the operator wants to move a user from one tag to another, they would need to open the user or the tags, uncheck the old and check the new tag/user, and save the changes.
Instead, we can create a UserRightClickMenu click script with the following script:
Enable and save the script, naming it Move to First and when you click on a user on the map or in the vehicle list, you will see that a new option is available.
Open the created click script again. With the Create Copy button, you can quickly create a copy of it, and quickly create analogous scripts for moving the user to the second and the third tag.
Name the second script Move to Second, change the last three lines to the following, then save:
Name the third script Move to Third, change the last three lines to the following, then save:
After saving the other two scripts, the user right-click menu should have all three available options. Clicking on any of them will execute the script, adding the user to the appropriate tag while removing it from the other two. Reopen a user or tag edit window to see the changes.
- As with geofence click scripts, you can also generate HTTP requests with these scripts. Read more on the geofence click scripts for instructions on enabling logging from a script to a log file.
- Note that clicking Run Script while editing click scripts actually runs the script for the selected user, executing any of the specified actions (e.g. adding/removing tags as in the example above).
- When editing the script, click on the items in the object tree of the script editor to see more detailed information on other parameters and methods available for this type of script.