How to Get Last Item ID from SharePoint List in Power Automate?

Are you aware of how to get last item ID from SharePoint list in Power Automate? No, then don’t worry!

In this Power Automate tutorial, I will demonstrate how to get the last item ID from the SharePoint list in Power Automate.

Moreover, I will explain how to get the last item ID from a SharePoint custom column using Power Automate.

Power Automate Get items action retrieves all the item information from a SharePoint list. It also allows you to filter items based on condition while retrieving items from the SharePoint list.

How to Get Last Item ID from SharePoint List in Power Automate

Let’s find out how to get the last item ID from a SharePoint ID column using Power Automate.

Here, I have used a SharePoint list named ‘Events’ with a few columns and data types.

Columns Data Types
IDNumber
Event Name(renamed Title column)Single line of text
Event DescriptionMultiple lines of text
Event Date & TimeSingle line of text
Event OrganizerPerson or Group
How to get last item ID from a SharePoint ID Column using Power Automate

Here, I want to retrieve the last item ID from a SharePoint list, so I have created a Power Automate cloud flow that will get triggered when an item is created or modified in a SharePoint List. Then, I want to reflect that last ID and details of that SharePoint item in an email.

The screenshot below shows the last item ID details of the SharePoint List in an email.

How to get last item ID from a SharePoint ID column in Power Automate
Get SharePoint last item ID from a SharePoint ID column using Power Automate

To achieve this, follow the steps below.

1. Open the Power Automate home page in your browser, click on + Create -> Select the Automated cloud flow -> Enter the flow name and choose the trigger’s flow (When an item is created and modified)

  • In this trigger, provide the Site Address and List Name.
Get last SharePoint item ID from SharePoint column using Power Automate

2. To filter items based on condition while retrieving items from the SharePoint list, add the ‘Get items’ flow action and set the details

  • Site Address: Provide the SharePoint site address.
  • List Name: Select the list of SharePoint.
Get last item ID from SharePoint in Power Automate

3. Next, to get the last item ID from a SharePoint list using the last function, add the ‘Compose’ flow action.

last(outputs('Get_items')?['body/value'])?['ID']

Where ID is the SharePoint in-built column.

How to get last SharePoint item ID from SharePoint ID column in Power Automate

4. Add the ‘Send an email (V2)’ flow action and set all the details.

  • To: Give the user the email address to whom you want to send email.
  • Subject: Provide the purpose for sending this email.
  • Body: Here, I have given the Output of Compose action from dynamic content. To provide a Link to Item, we used an expression in Code view (</>) mode, as shown below.
<a href='@{items('Apply_to_each')?['{Link}']}'>Click Here</a>
How to get last item ID from SharePoint list in Power Automate

5. Now click on Save and Test. Test it Manually and click on Run flow. The Compose flow action will display the output based on the expression inserted in the Inputs of the Compose flow action as shown below.

Get SharePoint last item ID from SharePoint custom ID column using Power Automate

This is how to get the last item ID from a SharePoint ID column using Power Automate.

Get Last Item ID from a SharePoint Custom Column using Power Automate

I will show how to get the last item ID from a SharePoint custom column using Power Automate.

For this, I have taken a SharePoint list named ‘Product Inventory’ with a few columns and their data types.

ColumnsData Types
Product NameSingle line of text
Product IDSingle line of text
Product BrandChoice
Product QuantityNumber
Product Manufacture DateDate and Time
How to get SharePoint last item ID from SharePoint custom column in Power Automate

Example:

Suppose I have created a SharePoint list with a custom ID column. Now, I want to retrieve the last item ID from the SharePoint list and reflect the details of that SharePoint item in an email.

The below screenshot shows the ID of a SharePoint List and the second image shows the ID we retrieved after the flow ran successfully in an email.

Get last SharePoint item ID from a SharePoint custom ID column using Power Automate
How to get the last item ID from a SharePoint custom column using Power Automate

To achieve this, follow the steps below.

1. Navigate to https://make.powerautomate.com in your browser to open the Power Automate home page; click on + Create -> Select the Automated cloud flow -> Provide the flow name and choose trigger’s flow (When an item is created and modified).

  • Provide the Site address and List Name for this trigger.
Get last item ID from SharePoint custom column in Power Automate

2. Add the ‘Get items’ flow action to filter items based on condition while retrieving from the SharePoint list and setting the required fields.

  • Site Address: Provide the SharePoint site address.
  • List Name: Select the name of the SharePoint list.
How to get SharePoint last item ID using Power Automate

3. Next, add the ‘Compose’ flow action to retrieve the SharePoint last item ID, as shown below.

last(outputs('Get_items')?['body/value'])['ProductID']

Where Product ID is the SharePoint custom column for ID.

Get last item ID from SharePoint custom ID column using Power Automate

4. Add the ‘Send an email’ flow action to send the details of the SharePoint last item with the ID and set all the details.

  • To: Here, provide the user email address; I have given Modified By Email from dynamic content.
  • Subject: Give the purpose of this email.
  • Body: Select values from Dynamic content as shown below. To provide the Link to Item use an expression in Code view (</>) mode.
<a href='@{items('Apply_to_each')?['{Link}']}'>Click Here</a>
How to get last item ID from SharePoint custom column in Power Automate

5. Now, it’s time to Save and Test. Click on Test and test it Manually -> The Compose flow action will display the output based on the SharePoint custom column below.

Get last item ID from custom column of a SharePoint list in Power Automate

This is how to get the last item ID from a SharePoint custom column using Power Automate.

Conclusion

I hope this Power Automate tutorial taught you how to get the item ID in Power Automate. Moreover:

  • Get the last item ID from a SharePoint ID column using Power Automate
  • Get the last item ID from a SharePoint custom column using Power Automate

Also, you may like some more Power Automate tutorials: