Use Data Entities in Dynamics 365 Finance & SCM to expose Business Logic
13. April 2021 Leave a comment
Entities in Dynamics 365 Finance & Supply Chain are not only good to access data. Entities can also be used to execute X++ business logic from 3rd party applications like Power Automate.
For example a table contains shipping carrier records. A Carrier has a Name and Description. The name is the primary key. The combination of Name and DataAreaId makes a record unique at the database.

There is also an entity to access the data.
An Action is a piece of X++ logic exposed via entity. This example sets the Carrier as default value for a customer:
public class DMOCarrierTableEntity extends common
{
/// Set as default
/// Customer Account
[SysODataActionAttribute('SetDefault', true)]
public void approve(CustAccount _custAccount)
{
ttsbegin;
CustTable custTable = CustTable::find(_custAccount,true);
custTable.DMOPreferredCarrier = this.Name;
custTable.update();
ttscommit;
}
Such an action can be called via Power Automate: