Newly available in v18 R4 is the ability to create ORDA Class functions. How are these useful? Imagine that you have a database of Companies' revenues, and you want to build a website to display those stats.
In particular, you want to get the average revenue of an entity selection of Companies. To accomplish this, you can create an entity selection class function like below:
The above "getAverageRevenue" function simply calculates the average of the revenue field for the entity selection This and outputs the result. The function can then be called in a POST request by the website to retreive information on the average revenue for certain Companies. For example, if you wanted to retrieve the average revenue for all Companies, you can structure the request like below:
POST http://myDomain/rest/Companies/getAverageRevenue
Testing the request with Postman, you should get a response like this:
If you wanted to filter Companies into an entity selection of just the tech companies, for example, you can structure the request like below:
POST http://myDomain/rest/Companies/getAverageRevenue?$filter="category=tech"
Then, you should receive a different result: