Imagine the following case. You have a Registration for an event. The price for that Registration depends on which Event the participant is registering for. And the amount for the Registration might depend on the number of participants in the Registration. You might even have a field to specify if the participant wants to stay the night, but only if it is a multiple-day Event.
In this case, you cannot set pre-defined values for the entry form because you cannot predict which Event the user will select. You can however build this case using the Input Triggers from the BusinessEntity Property.
Add a Trigger to a BusinessEntity Property
To configure this case, start the Silver (Quick) Editor and go to the BusinessEntity Properties. Select the Property that should be updated. Expand the Input Panel and specify the Property that should be checked for changes by entering the name in the "Trigger Properties" field. You can even specify multiple fields by separating them using semi-colons.
In the "Recalculation Function" field, you can now specify what should happen if one of the triggered fields changes. You have the following options:
You can specify a BusinessEntityProperty. In that case, the value of that BusinessEntityProperty will be copied into this field. You can use this for example to copy a short description into a long description field which the user can expand later on.
- Basement or BasementCall
You can use a Basement or BasementCall to retrieve a specific value. In this example we've used the OleDBTools function GetValueFromTable to retrieve the default price from the selected Event, using the EventID.
Next, let's have a look at the Nett Price. This field should be updated when the DefaultPrice changes. And it should be updated when a Discount is applied. So for this field, we have specified 2 Trigger Properties.
As you can see, we have added a Trigger to the DefaultPrice. Which itself has a Trigger to the EventID. That means, when the EventID changes, the DefaultPrice will be updated and after that, the NettPrice will be updated. In other words, this is a cascading model.
And to finalize this example, we have put similar Triggers for the Amount field.
A different usage of Trigger Properties
There is another case in which you can use Trigger Properties. Let's have a look at the following example:
Here we are looking at the configuration of an Opportunity. The user can select an existing Organization using the OrganizationID. The information of that Organization is copied in the name and address fields. So far, it's the same as the previous example. But here's the other trick. If the user selects an existing Organization, we don't need to see the name and address fields any longer.
So we have made the Hide from UI setting dynamic, using a Basement function.
Here we used the Basement function from the EssenceValidators, GuidHasValue. We check if the BusinessEntityProperty Opportunity.OrganizationID has a value. If so, the user selected an existing Organization and the field will be hidden. If the user does not select an existing Organization, or the selection is cleared, the field will be made visible again.
Let's wrap it up
Using the Input Trigger Properties, you can dynamically change the input values in forms, depending on the user entry. You can also use them to change the behavior of a field because the whole Property will be re-evaluated. So you can also use it to hide fields from the entry form, make fields mandatory based upon the user entry, make it read-only and more!