Filter odata by enum in the URL

So apparently you cannot use simple string filter to filter odata by enum. You have to reference the enum that you are using in the URL.

For example if you want to filter salesLine data entity by SalesLineStatus field with value invoiced, you have to do the following

https://365DFOP.cloudax.dynamics.com/data/SalesOrderLines?$filter=SalesOrderLineStatus eq Microsoft.Dynamics.DataEntities.SalesStatus'Invoiced'

where

Data entity name –  SalesOrderLines

field name – SalesOrderLineStatus

Enum name – SalesStatus

Referenced enum value – Invoiced

Advertisements

SalesTable Totals discount amount etc

This functionality help to find TotalAmount TaxAmount DiscountAmount and etc from salesTable. I won’t be copying the code here, but I will be linking the blog post where I found that infromation

https://community.dynamics.com/ax/b/microsoftdynamicsaxextensions/archive/2015/08/31/sales-order-total-by-code-x

 

Looks like similar functionality exists for Purchase Orders too in class PurchTotals.