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 :
Finance | Project Operations, Human Resources, ...
Answered

Primary Index need to change on Sales table in D365FO

(2) ShareShare
ReportReport
Posted on by 1,323
Dear team 
 
As per our discussion with team I might need to change the primary index on Sales Table.
 
In between , I would like to know how will I handle these scenario. Is it possible to change the primary index?
 
As I think, if I change the primary index on Sales table, it will impact the existing records as well. If I am not wrong.
 
Could you please suggest me, how will I handle this situation , so that without hampering the existing data on sales table ,I can change the primary index on Sales Table.
 
Kindly advise pls.
 
Thanks in advance.
Categories:
I have the same question (0)
  • Sohaib Cheema Profile Picture
    49,677 Super User 2026 Season 1 on at
    Hi,
    You would not be able to change the Primary index via extension of the table. However you can create the additional indexes. You can also add additional validations (to control any behaviour)
  • CU05031448-0 Profile Picture
    1,323 on at
    Thanks Sohaib 
     
    Suppose if I create an additional index on Sales table extension. Say CustIdx...
     
    So, let's assume we now have two indexes like Salesidx (primary) and CustIdx (additional) newly added.
     
    So, when Sales table is executed then how the index will work?
     
    Is it called first Primary index and then additional index. So on...
     
    Am I correct?
     
    Thanks!
  • André Arnaud de Calavon Profile Picture
    303,669 Super User 2026 Season 1 on at
    Hi,

    As mentioned, you can't change the primary index. What is the business scenario you want to solve? A primary index keeps records unique in the application. For sales orders, this is the sales order ID. I have not seen a scenario myself where this needed to be changed.

    You are talking about a second index. What is the purpose of that index? Additional indexes can be used to retrieve data faster in case of filtering, but it also takes more time to insert or update records in case the field is part of an index. Indexes can also be used for sorting purposes.
  • CU05031448-0 Profile Picture
    1,323 on at
    Thanks Andre for the reply.
     
    Actually I have added one new column in Sales table extension say "MiscSO".
     
    We like to add the field "MiscSO" with Salesidx primary index to make unique. Which is not at all possible.
     
    Could you please provide me alternative solution for this pls 
     
    Thanks in advance!
  • Verified answer
    Martin Dráb Profile Picture
    239,029 Most Valuable Professional on at
    You can't change the primary index, but it seems that the only reason why you wanted to do so was that you incorrectly believed that only the primary index can be unique. That's wrong; you can create multiple unique indexes. Simple set index's Allow Duplicates property to No.
    But before you do so, initialize unique values in all existing records, otherwise the index couldn't be created (by DB synchronization). 
  • CU05031448-0 Profile Picture
    1,323 on at
    Thanks Martin,
     
    As you said "before you do so, initialize unique values in all existing records, otherwise the index couldn't be created (by DB synchronization). "
     
    Initialized unique values in all existing records ...
     
    Sorry not understand, pls let me know how will I do that.
     
    Thanks!
  • Verified answer
    Martin Dráb Profile Picture
    239,029 Most Valuable Professional on at
    Let's say you create add a string field called Field1 and and create a unique index on it. Let's also assume that you already have a hundred SalesTable records.
     
    Because Field1 is a new field, it's empty for all records. Therefore the values are not unique and an attempt to create an index guaranteeing uniqueness will fails.
     
    If you want to have a unique index, you'll have to assign a unique value to each record.

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 617

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 461 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 298 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans