web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to get latest id o...
Power Automate
Answered

How to get latest id of duplicates record?

(0) ShareShare
ReportReport
Posted on by 353

hi all.

i have column company in my sharepoint list. I want to check if there is duplicates in the column. if there is duplicates, i want to get the id of the previous duplicates item.

 

let's say:

 

id                  company

1                          a

2                          b

3                          b

 

when user submit new form and the company column is company b, flow should get the id for previous data of company b. in this case, the answer should be 3 (instead of 2).

how  do i do that?

thanks!

Categories:
  • Verified answer
    sudharsan1985 Profile Picture
    1,325 on at

    Hi @_kikilalaaa 

    I had tested the below flow using a sample list having a column 'Company'. Below is the screenshot of the list and the items

    Res 1.png

    A flow has been created whenever an item is created in the above-mentioned list. When i created an item '21' with the same 'Company' name the flow returns the ID as 20.

    Below is the 'Get Items' action with the configuration for your reference.

    Res 2.png

     The condition is checking the company with the ID not equal to the current item ID and sorting the results with ID desc.

     

    Hope it helps, please like it or mark it as a solution if it resolves ur clarification or issue

    -Sudharsan K...

     

  • _kikilalaaa Profile Picture
    353 on at

    Hi, I have tried your solution but I face this error:

    The expressions \"Company eq 'Company 1' and InputID ne InputID-35 \" is not valid.

     

    do you have any idea why this is happened?

    for your info, I used instant flow and powerapps is the trigger. when i run the flow, they ask me for getItems_FilterQuery. 

  • sudharsan1985 Profile Picture
    1,325 on at

    Hi @_kikilalaaa 

    I am sorry that you faced an issue with the query. I had clearly mentioned in the post that the action is triggered whenever a new item is created in SharePoint. I am not sure about how it triggered from Power App.

    My solution is using only SharePoint and Flow, its completely free from Power Apps.

     

    Hope it helps, please like it or mark it as a solution if it resolves ur clarification or issue

    -Sudharsan K...

  • _kikilalaaa Profile Picture
    353 on at

    Hi, I understand that. I have tried to do it again. It occurs because my id is string type, so in the filter, it should be single quoted.

     

    I have fix the issue but I have other issue.

     

    Actually, I have set the company column as "TO/FROM". 

    However, when I do the filter, the following error is received:

    "Column 'To' does not exist."

     

    It seems like it detect the column in filter as "To", not "To/From". I am not sure if this happens because of the "/" symbol. 

    do you have any idea?

    thanks!

  • sudharsan1985 Profile Picture
    1,325 on at

    Hi @_kikilalaaa 

    Make sure you give the internal name of the SharePoint field. It can be found using the list settings. Click the field and on the address bar, you can see the internal name. The first time when the field is created, the internal name is also created with some chars added for space and special characters. Even after you try to change the field name, the internal name is not changed and only the display name is changed. SharePoint online automatically truncates the spaces between the field names and it generate the internal name. If you had created 'Company Name' using the modern list UI, the internal name would be 'CompanyName'

     

    Hope it helps, please like it or mark it as a solution if it resolves ur clarification or issue

    -Sudharsan K...

     

  • _kikilalaaa Profile Picture
    353 on at

    i have checked, it happened for symbols/ space, it should be replaced with x0020. 

    i have tried and it didn't show any error but it did not return the previous latest record. can you show me how does it configure yours?

     

  • sudharsan1985 Profile Picture
    1,325 on at

    Hi @_kikilalaaa 

    I tried creating a column named 'TO/FROM' and after creation, when I checked the internal name of the column, it is like the below

    TO_x002f_FROM. Please don't worry about the internal name, if the internal name 'To' worked then I say its good to go. As long as the 'Display Name' is ok for the end-users all should be fine.

     

    Hope it helps, please like it or mark it as a solution if it resolves ur clarification or issue

    -Sudharsan K...

     

  • _kikilalaaa Profile Picture
    353 on at

    thank you so much!! it works perfectly! have a nice day~

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 445

#2
11manish Profile Picture

11manish 345 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 300

Last 30 days Overall leaderboard