Working with page triggers
Page triggers are used to change the way page data is presented to the user. In this recipe, we will use triggers to calculate a value that will be displayed in the page "on-the-fly", when a record in retrieved from the database. Besides, trigger code will update the style of text boxes depending on the data displayed in them.
How to do it...
To illustrate the data presentation in a page, we write page trigger code highlighting expired certificates to draw user's attention to entries demanding immediate action.
Open the page 50010 Item Certificate Card in page designer. Declare a global variable
ExpirationDate
of the Date type.Insert a new field in the General group, just below the field Issued Date. Set SourceExpr = ExpirationDate to make the
ExpirationDate
variable as the data source for the new field.Open the C/AL Code page. Declare a function
GetCertificateExpirationDate
.Open function parameters and add one parameter:
Name
DataType
Length
CertificateNo...