Skip to main content



No record found.

Microsoft Dynamics AX forum

Stop Duplicate records based on new field

Posted on by 794

Hi All,

I have small query about controlling duplicate records based new field created on salesTable

We have added new field in SalesTable called "XReference" and Field data  getting inserted when sales order is getting created from 3rd party application(By service). 

We want to maintain uniqueness based on xreference and salesid. So we have added a condition to avoid duplication at service level but in some scenarios two sales orders having sames Xreference. (There are some calls are happening exactly at same time not even having difference in seconds )

we can't create new unique index(combination of SalesId and Xreference) as we have many duplicate records with this combination(Settle credit not for those ordes).

how we can control duplication records(Based on combination of Sales ID and Xrefence).

We can handle at 3rd party application level but due some reasons we are unable to



  • WillWU Profile Picture
    WillWU 22,344 on at
    RE: Stop Duplicate records based on new field

    Hi Kvnkk,

    What do you mean by "duplication records", you could use RecId to avoid duplication records.

    Although their XReference is the same, will it affect the data insertion?

    And you could always use salesTable::exist(XReference xReference) to check if you have the same record.

    You could make some changes to the xReference if the exist() method return true.

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .


André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 288,459 Super User

Martin Dráb Profile Picture

Martin Dráb 225,783 Super User

nmaenpaa Profile Picture

nmaenpaa 101,148


Featured topics

Product updates

Dynamics 365 release plans