What is a Trigger?
We can perform any action on a specific events like On change of field value, On Focus of a field, On Blur of a field,Record Active, Data change etc using triggers. We can add N number of actions under trigger.
Trigger on Change:
This trigger can be used when we want to perform any action on change of field value.
How to configure Trigger on Change?
Consider a scenario where you have two date fields (i) Due Date (ii) Original Date. When you change the Due date and if the Original Due date value is null then due date will be copied to Original due date. This can be acheived using Trigger on Change.
Under Trigger we can add any action can be used based on requirement.
Under this Trigger action you can specify any number of button actions.
Now Consider a scenario where you want to show the City and Zipcode fields when the State field is focused.
This trigger can be used when we want to perform action when field loose it's focus.Let's take previous TextArea example.On focus of a field we increased height of TextArea. Now we need to reset it's height.So on TriggerOnBlur we can reduce text area height by using ActionSetHeight.
When the Document Content Panel is clicked, it should be directed to the document submission form.
Trigger On TabActive:
Note: If we uses GoToTarget inside TriggerOnTabActive to focus any field then platform will skip auto focus of first field to make sure that focus should go whereever developer want.
Consider you have two tabs(Shipments,Sales Orders). When the Sales Orders tab is clicked, the focus should be on the supplier name field.
Here salesgrid is the grid itemid and item69 is the field item id.
Trigger On Record Active:
This trigger can be used whenever we need to perform any action on record active of grid. Lets consider a scenario, whenever end user goes to each row in the grid and based on row data, we need to to show and hide some button or any other case then we can use TriggerOnRecordActive and then we can use respective actions under that.
Note: Generally we use this trigger as a child of a Grid.
How to configure Trigger On Record Active?
- First go to the widget and click on new. A new child item will be added.
- Select the item type as TriggerRecordActive.
- Specify the condition if any.
- Below that add a button action according to your need.
- Here ActionInvokeDatasource is added.
- Below that add Set data properties.
- Add Get data properties.
- You can add as many button actions as needed according to your requirement.
Here the employee name is validated in the Trigger On BeforeCommit.
Inside this trigger, we can perform validation and if any validation fails then we can stop popup from being close. We can use ActionAbort inside TriggerOnBeforePoupClose to prevent popup from closing.
Example: To Create an order, the shipping date is mandatory, so untill and unless the shipping date is specified, the popup should not close.
Here consider that you need to clear the filter before search.
The Trigger On Before Search will be visible in the property pallet if and only if the Simple Search Property of the grid if enabled.
Here item354 is the item id of the grid.
Consider you want to list all the shipment details when the image is clicked. First Upload the image using the Image Uploader.
Create a html field and specify the text as <img src="appimages/Shipping.png" height="30px" width="20px"></img>.
Click on Save.
Now specify the Trigger On Click event for the html component.
Create a button action goto target. This will take you to the Shipment Details page.
Consider a confirmation message has to be returned when data is committed successfully.
Consider you want to display Contact info when you mouse over on the supplier name.
Consider the above example where on mouse over, the supplier contact info is being displayed and now on mouse out the supplier contact info has to be hidden.
This event fires only when the first time page is loaded and from the next time on a postback Page_init is not fired.
Consider two tabs(Dashboard Tab,Sales Activities Tab).
Now when the Manager log's in he should be able to see both the tabs.
When the user log's in, he should be able to see only the Sales Activities tab.
For this first add the Trigger On Page Init event to the layout container next to the page item.
Then add the Action Show button action with visibility condition.(Has Role('User')).
Consider you want to validate the record before you insert.
To do that, you need to invoke data source and inturn call a procedure by specifying the package name in the API field.
Do the validations in the package and then insert the data into the tables.
Consider you have the menu item 1) Applicant History 2) Applicant Info.
When checkbox of Applicant History is checked, it should show a popup with all the Applicant History records grid.
When checkbox of Applicant History is unchecked, it should close the Applicant History Popup.
Trigger On Data Change: