In my previous post, we’ve walked through a Logic App workflow to get the latest item in an array, by combining the
Select action and the
Once the Integration Account instance is provisioned, connect it with the existing Logic App instance to use the action.
Currently, the action supports the built-in functions of node.js
8.11.1. We can’t import external libraries through
npm or so. Therefore, we can’t rely on any
require() statement. Everything MUST stay in the action.
The callback function SHOULD return either
-1means, between the array items
ais sent to the lower index.
1means the array item
bis sent to the lower index.
Therefore, the callback function gets rid of
.json from the
Name property value of both
b, compare both values to each other, and the later (larger) one goes to the upper place of the array item (takes the lower index). In other words, the array items are sorted in descending order.
If you want to know more about the sort, please refer to this page.
Now, let’s apply this code into Logic App.
itemsvariable takes the array items from the output of the previous action,
- In the last line, it uses the
returnstatement to send the result of the action to the
If we want to refer the result of this action, any action later in this workflow can use
The right-hand side is what we created in the previous post. At least we SHOULD use both the
Select Filename from Backups action (
Select) and the
Take Latest Backup action (
Filter). If we want a more elegant way, a few extra actions are placed before and after.
But there’s a caveat. Make sure that we have to have the Integration Account associated with using this inline code action. The Integration Account is pretty expensive and fixed price – US$ 302.4 (Basic) and US$ 986.4 (Standard) per month. If your organisation has already been using the Integration Account, then it’s OK. However, if it hasn’t, it SHOULD be really careful.