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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Suggested Answer

Different Sequence of Auto-Numbering within One Entity

(0) ShareShare
ReportReport
Posted on by 50

Hello All,

I have multiple country names in one entity. I want records of each country to start with it's own auto-number sequencing.

I used XRM tool but but it gives me auto numbering for all records.

For example, country UK records should start with 1001, 1002, 1003,....

                        county Japan records should start with 1001, 1002, 1003,...

   You get the point.  Also, I am not using canvas power apps, I do not have auto number data type

I have the same question (0)
  • Suggested answer
    LeoAlt Profile Picture
    16,331 Moderator on at

    Hi Partner,

    Unfortunately there is no OOB way to do this.

    You could use Power Automate instead, here are the steps.

    1.Create a new Flow and set its trigger condition to when creating a new record.

    pastedimage1596784186963v1.png

    2.Create a list records action to list all the entity records whose country equals the current new created one.

    pastedimage1596784749701v2.png

    3.Create a condition to check if the list records result is 0. If is 0, it means there is no other records with the same country you are creating, then add another condition to check the current country to set different number based on different countries. In my case, I set China to 1001 and Japan to 2001.

    pastedimage1596785513101v4.png

    To get the result of list  records, please use length(body('action name')?['value']).

    4.If the result of list record is not 0, then create an update action to update the auto-number field. Here I used the Name field as auto number field, so I need to convert it from string to int first, and then +1 for this field to get new number for new record.

    pastedimage1596785585494v5.png

    Best Regards,

    Leo

  • Manny Floyd Profile Picture
    50 on at

    Hi Leo, thanks for your reply.

    I am getting this error on filter query

    "Order By Property must be of type EdmProperty"
  • Manny Floyd Profile Picture
    50 on at

    Hi  - seems like Created On ( Date and time) is not liked by Order By

  • Suggested answer
    LeoAlt Profile Picture
    16,331 Moderator on at

    Hi Manny,

    Sorry for that issue, you should change the field to manually filling like I showed below, and then it will work well.

    pastedimage1597023529346v1.png

    Regards,

    Leo

  • Manny Floyd Profile Picture
    50 on at

    Hi Leo, thank you so much - that worked.

    question :

    What goes in : length(body('action name')?['value']). ???  I have a demo next week and our developer is out sick, that's why I am asking questions - want to keep customer happy (-;

  • LeoAlt Profile Picture
    16,331 Moderator on at

    Hi partner,

     length(body('action name')?['value']) is used to get the count of the records that from the "List Records" action.

    pastedimage1597027945129v1.png

    The "Action Name" is the action name you want to use, in our case, the action name is "List_records". And you could also get this by the following steps.

    1.Choose Length function first.

    pastedimage1597028043946v2.png

    2.In the brackets, select the "Value".

    pastedimage1597028110724v4.png

    pastedimage1597028089598v3.png

    Best Regards,

    Leo

  • Manny Floyd Profile Picture
    50 on at

    An action failed. No dependent actions succeeded. What is inside int in last step?

    I think I am using incorrect values in int expression. Please help

     

    pastedimage1597030330932v1.png

  • Manny Floyd Profile Picture
    50 on at

    If I try to convert "name" to int, it gives me an error

    If I use Country Value to Int, on Name field it gives me  0+ 1 for China, 1+ 0 for Japan

    Can you help me with Int function ?

    see below

    pastedimage1597090808755v1.png

  • Suggested answer
    LeoAlt Profile Picture
    16,331 Moderator on at

    Hi partner,

    You should use add() expression to do plus action.

    pastedimage1597129467472v1.png

    And if the Entity Number field is a string field, you should use "

    add(int(outputs('List_records')?['body/new_name']),1)

    "

    Best Regards,

    Leo

  • Manny Floyd Profile Picture
    50 on at

    Hi Leo, still same error. Not sure what I am doing wrong.

    In Condition 2 I have new_countryname value is equal to 1

    is it correct?

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Service | Customer Service, Contact Center, Field Service, Guides

#1
NeerajPawar Profile Picture

NeerajPawar 31

#2
Tom_Gioielli Profile Picture

Tom_Gioielli 21 Super User 2026 Season 1

#3
11manish Profile Picture

11manish 16

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans