Print this page
Reading time: 2 - 3 minutes
03 December 2020


Recently, I’ve had a couple of requests which have required me to access some data via an API call. This is something that I’d always shied away from as it seems to be overly complicated and unnecessary but, when it was clear that it was needed, then the time had come to grasp the nettle.

There’s a couple of things that I wanted to highlight as my journey into the world of API calls begins.

Finding an entity’s name

The first one was something that had been bugging me for ages. When I was writing some Flows (because workflows are sooo last year), I had to update some lookup values in there. I know how these need an entity prefix, which refers to the entity as a plural (but not the plural you enter when it’s set up) so, if I want to set an account, I have to begin with ‘accounts/…’. I’d made the silly mistake of naming my entity with an ‘s’ on the end of its schema name (something like ‘prefix_newproducts’) and, no matter what I tried, I couldn’t get my declaration to work. I also had no idea how to find out the method of calling it. Then I discovered the API call to list the entities:

And there it was. All the entities were listed in a way that I could call them. I saw that ‘prefix_newproducts’ had become ‘prefix_newproductses’ so, not only did I sound like Golem from Lord of the Rings when I said it, I was also able to complete my Flow.

Accessing the records

Next, I needed to write a report that was aggregating Case data. Based on how the format the output needed to be in, Power Automate seemed like the best method. So I started by using a recurring Flow, followed by a ‘list’ step and then counting the number of records in the list. This worked for the daily figures as well as the monthly ones but, when it came to the yearly total, the count it gave me was 5000 and all I could think was ‘that’s a handy round number’. It was only when I made some changes to this, and it still came out at 5000 did I realise that this is the maximum number of records this could return.

After much experimenting with splitting the ‘list’ down into various steps (which did work although it never seemed like this was the way it should be done), I decided to do a bit of research. I found that by calling:

I was able to access the data behind the FetchXML call as a chunk of JSON. It was then just a case of putting some aggregation into the call, and there was my figure. Not only did this seem like a much more elegant way of doing this, but it also executed very quickly compared to the multiple ‘list’ steps I’d written.

So I think there’s a lot more to discover with the API calls within Dynamics, but they certainly seem to provide some useful tools.

英雄联盟竞猜排名赛事网址 欧洲电竞下注下载v10.1版 英雄联盟竞猜下注下载网 pc28加拿大大小计划最稳网 28加拿大开奖软件数据 英雄联盟竞猜注册比分0.1.6