Command Click Scripts
Command Click Scripts allow you to assign or remove a user from tags after a command is executed successfully for the user.
- Login to SiteAdmin.
- Go to Plugins tab.
- Set the Repository URL to http://update.gpsgate.com
- Under My Plugins tab, make sure that all plugins are up to date.
Enabling and Creating Click Scripts
Details on enabling and creating Click Scripts can be found here.
To create a Command Click Script, go to menu Development -> App Builder. Click on an already created App or create a new one. In the Click Scripts section, click on Add new Click Script button. Select the Command kind in the Edit Click Script form. Set the new click script to Enabled.
In Command Tags section of the click script, select the Command Tags associated with this script. The script will be executed after a successful completion of a command only if the command is in this Command Tag.
Finally, for the script to be executed, the user creating the script must be in a role with _UseClickScriptprivilege enabled for that script.
Example: moving a user between tags
Let us suppose that there are two template commands that can be executed on some users, “ModeA” and “ModeB”. We want to move a user between tags depending on which of the two commands was executed last. It should be in tag “First” if “ModeA” was executed last or in tag “Second” if “ModeB” was executed last.
To replicate the example, before we set up the script it is necessary to create:
- Tags “First” and “Second”
- Template commands “ModeA” and “ModeB” (more on creating template commands can be found here)
- A Command Tag which will contain both of these commands (more on Command Tags can be found here)
Now you can create a new Command Click Script with the created Command Tag selected.
Finally, the script that will move the user between tags based on last executed of the two commands will look like this:
Running the script from the editor once with one of the two commands specified in the Exposed objects and test values section under command.name should immediately move a user to the right tag and validate the script.
Now save the script and run the other command. After the command is completed you will see that the user has moved to the other tag.