Click Scripts in User Right Click Menu
You can now create Click Scripts executed from user right click menu. Combine multiple actions commonly used together, such as adding a user to a tag while removing it from other tags, into one.
- Log in to SiteAdmin.
- Go to the Plugins tab.
- Under My Plugins tab, make sure all plugins are up to date
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 Click Scripts section).
To create Click Scripts shown in the user right click menu, select the UserRightClickMenu kind in the Edit Click Script form. In this case, “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.
- See the previous entry on Click Scripts for instructions on how to enable 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 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.
Discuss this blog post on the forum please