In the last post, we created a field trigger for updating prices in the Assets table. In this one, we’re going to update asset prices using Power Automate and free APIs. We’ll give users the option to update an asset on demand, but we’ll also create a background flow that continuously updates asset prices.
For this development, we’ll be using two free APIs: one from Yahoo that ChatGPT suggested, and another from the Astana Stock Exchange, which I found while inspecting the AIX website backend. Free APIs are like ducks in the park, you can take a couple home, and nobody’s going to stop you, but if you take too many, they’ll ban you from coming back. For this reason, we’re going to limit the number of API calls in the background flow to something reasonable.
By the time you’re reading this guide, the APIs might no longer work, but I’ll explain everything in a way that’s easy to adapt to other APIs. You can test them here (yahoo) and here (AIX). If a JSON file opens in your browser, it means they’re working.
The flow
Let’s create an automated flow in our solution:

First, let’s give it a name and select the trigger. In our case, we’ll choose “When a row is added, modified, or deleted” because we want the flow to trigger when the “Update Price” field is toggled to Yes.

Modern vs Classic UI
When my flow opened, I expected the new UI that everyone’s been complaining about, but instead, I got the classic one. I’m going to switch to the new UI because it has Copilot, but first, we need to save this flow. For that, we’ll need a trigger plus an action.

In this first step, I’m setting it to trigger when a row from “Assets” is modified by anyone in the “Organization”.
Then, I’m going to create a variable to store the ticker:


Now, I’m going to switch to the modern UI by saving this flow (top right) and opening https://make.powerautomate.com/. There, we can reopen our flow in our solution:


The flow
Now that we’re in the modern UI, we can easily filter which fields and what values those fields need to have to trigger the flow. My field’s logical name is arc7879_updateprice
, and you can find yours in the table columns:

We can modify the trigger so it will only trigger when the arc7879_updateprice
field is switched:

Finally, in Filter Rows, we can set it to trigger only when the arc7879_updateprice
field is set to 'Yes'
. To get the formula, we could try using Copilot:

Sadly, we get a wrong answer:

But we can use other AIs, like the free version of DeepSeek:

So it should look like:

Now we can test if the flow gets triggered by selecting “Test” and then “Manual”:

Let’s click the Update Price button:

If everything went well, we should see:

Now let’s initialize our ticker. We’re going to use the record’s ticker plus the exchange because the Yahoo API adds a dot and an L if the ticker is from the UK, and a dot and DE if it’s from Germany. For the USA, there’s no suffix, and for Kazakhstan, we’re going to use a different API, so neither is necessary.
Here we have the fx button:

And I directly ask Copilot to give me the formula:
There is a field in the record with the logical name arc7879_ticker (string) and another field arc7879_exchange (choice). I need a concatenation of arc7879_ticker with ".L" if the choice is 525070001, ".DE" if the choice is 525070002, and no suffix if it’s any other value.

concat(triggerOutputs()?['body/arc7879_ticker'], if(equals(triggerOutputs()?['body/arc7879_exchange'], 525070001), '.L', if(equals(triggerOutputs()?['body/arc7879_exchange'], 525070002), '.DE', '')) )
The values of the choices can be found here:

In the next step, we’re going to create a Switch to check whether we should call the Yahoo or AIX API, depending on the market. The reason I’m not using a Condition (true or false) is that, in the future, we may want to modify our flow to add other exchanges and APIs:



Now let’s create the API call for AIX by selecting an HTTP action:

The formula in the URI is a concatenation of the URL and the ticker:
concat('https://market-backend.aixkz.com/api/symbol/trading-summary/', variables('Ticker'))
This API will return a JSON. To work with this JSON, we need to parse it using the action called Parse JSON. For the content, we’ll use the Body returned from the HTTP action:

The schema is the structure of the JSON. It’s very easy to get, just copy the content from any AIX request, for example this, and select “Use sample payload to generate schema,” and paste it there:



Now we need to save the stock price, but for that, we need a variable using the “Initialize variable” action. This variable should be declared in the global scope, which means it needs to be placed before the Switch. It also has to be of type Float (a numerical value with decimals):

Now we can set this variable for the AIX branch using the “Set variable” action. The AIX API has a peculiarity: if the stock is not trading, like during weekends, the value of the lastTradePrice
key is 0
. In that case, we need to use the previousClose
key instead, ChatGPT helped me create this formula and debug some errors, which is why it’s a bit complex.
if(
and(
not(equals(body('Parse_JSON')?['lastTradePrice'], null)),
not(equals(body('Parse_JSON')?['lastTradePrice'], 0))
),
body('Parse_JSON')?['lastTradePrice'],
if(
not(equals(body('Parse_JSON')?['previousClose'], null)),
body('Parse_JSON')?['previousClose'],
0
)
)

Now let’s move on to the Yahoo branch:
The steps will be the same, but we’ll use this sample to generate the JSON schema. The key we want is regularMarketPrice
, and since it’s inside an array, Power Automate will automatically place it inside a For Each loop. However, we don’t need to worry about that because there is only one element.

Finally, we can update our record with the Price
variable outside of the Switch using the “Upsert a row” action. Also, make sure to change the Update Price
variable to NO
:


Now we can publish our flow and test it. We may get a warning about a circular loop because our last action triggers the trigger, but since there’s a condition that requires the Update Price
field to be true
and we’re setting it to false
, nothing will go wrong.

So, while the price of the shares gets updated (Update Price
and then updating the record), there’s a detail I forgot, the currency!

No problem, let’s fix our flow. We’ll start by initializing a variable Currency:

And let’s set the variables for both branches:

currency
key, but it operates with USD.
Let’s find the record in the Currency table using the same ISO code with the List rows action:

And update the “Upsert a row” action:

Now we can publish the flow again, but let’s make sure the currencies exist in the system. If not, we can create them directly from the lookup:


And just add ‘New’:

Now we can check again:

Finally, we just need a flow that runs every hour, retrieves the oldest three updated assets (of asset type Stock), and sets the Update Price
field to Yes
. This will trigger the flow we just created.




Conclusion
The new UI with Copilot has a lot of potential. OData and Power Automate formula syntax can be a bit complicated, so AI can be really helpful. The problem is that Copilot isn’t there yet, it makes more mistakes than ChatGPT 4o and DeepSeek, and those are generic AIs. Additionally, it’s not context-aware. For example, when I asked for a formula in a field meant for OData, it provided a standard Power Automate formula instead.
[To be continued]
Leave a Reply