ICommand (deprecated)
This interface is deprecated. Instead of this interface use the IEntityCommand interface.
By implementing the ICommand interface in the application script, you can define custom ticket commands.
In the application, create a new script using the ICommand template and name it appropriately according to the functionality of the custom command. In the newly created script, set the id, name, position, and icon property values in the constructor of the command class:
- id - command number (unique)
- name - the name of the command that will be displayed in applications
- position - the position at which the command will be displayed in applications
- 1 = at the first position of the main ticket menu
- 2 = at the last position of the main ticket menu
- 3 = at the first position of the nested menu in the main ticket menu
- 4 = the last position of the nested offer in the main offer of the ticket
- icon - the name of the command icon
Use the Microsoft fluent library viewerwith “20 Regular” filter on. After finding the most suitable icon, copy its name without “fluent:” and replace “-“ characters for “_”. - Example: Icon with name “fluent:edit-20-regular” use in your code as “edit_20_regular”.
To store the properties and settings of the command, we recommend defining the Settings class in a separate script that you create from the Class Library template.
Interface methods
Method | Description |
---|---|
Show | Display the command in the ticket menu. |
Run | Run command. |
Show
This method checks the defined conditions for displaying the command.
By calling this method in the Run method, you can check if the conditions for displaying the query have changed between the time the query was displayed and the time the query was run.
- Syntax: boolShow (SqlConnection con, int ticketId, int personId)
- Parameters:
- con - SqlConnection to the database.
- ticketId - The ticket ID (tHdTicket.iHdTicketId) for which the command will be displayed.
- personId - the ID of the user (tPerson.iPersonId) to whom the command should be displayed.
- Return values:
- bool - the truth value of whether the command should be displayed to the user on the specified ticket.
You can find an example use case in the CostsCalculation application template.
Run
This method runs the command itself.
If the custom command is to open a different page from the Alvao WebApp,
use the Alvao.API.Common.DbProperty.WebAppUrl
property
from the Alvao.API
interface to get the root URL.
- Syntax: Tuple< bool, string, string> Run(SqlConnection con, int ticketId, int personId)
- Parameters:
- con - SqlConnection to the database.
- ticketId - The ticket ID (tHdTicket.iHdTicketId) over which the command is run.
- personId - The user ID (tPerson.iPersonId) that is running the command.
- Return values:
- bool - the truth value of whether the command was executed.
- string - text that can be displayed in the message to the user.
- string - URL to open in the browser.
You can find an example use case in the CostsCalculation application template.