Skip to main content

One post tagged with "throw"

View All Tags

Throw behaviour in X++

· 3 min read
Kome Hoang
Maintainer of Automaly

References

How to

Prerequisite

For the purpose of testing, I had this data set of CustGroup. This can also be found on Legal Entity USRT of demo data comes with a new environment of Dynamics 365 Finance.

Customer groupDescription
10Wholesale customers
20Major customers
30Retail customers
40Internet customers
50Employees
80Wholesale customers
90Wholesale customers

I added two new buttons on CustGroup form:

  • Bulk update Desc: This button will loop through each and all records in the above table and update the Description to Description + + Updated except one containing "Employee". They will become like below.
Customer groupDescription
10Wholesale customers + Updated
20Major customers + Updated
30Retail customers + Updated
40Internet customers + Updated
50Employees
80Wholesale customers + Updated
90Wholesale customers + Updated
  • Reverse Bulk update Desc: This button will update all Description back to its original by removing the word + Updated.

Let's do it

When we don't use throw

In the extension class named CustGroup_ButtonHandlers, I put these codes which will handle the event of clicking those two buttons.

tip

This type of FormControlEventHandler will only be needed when you are extending a standard form. For a totally custom form, you can add a Clicked() method method for any buttons on the form.