Use Data Entities in Dynamics 365 Finance & SCM to expose Business Logic

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.

Carrier Table

There is also an entity to access the data.

Carrier Table Entity

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:

Call custom action via Power Automate

About erpcoder
Azure Cloud Architect and Dynamics 365 enthusiast working in Research & Development for InsideAx

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: