0

Hiii, I am new to axapta

I have a table in which I want two fields together should act as a primary key. Is this possible or not

If not is there any alternate way to achieve.

Jan B. Kjeldsen
  • 17,817
  • 5
  • 32
  • 50
Vamshi
  • 11
  • 2
  • Welcome to Stack Overflow. Yes, this is possible. If you don't know how to do it, I recommend you get some training in D365FO development first. [80730AE: Development Basics in Microsoft Dynamics AX](https://mbspartner.microsoft.com/AX/CourseModules/1181) is a good place to start. – FH-Inway Dec 13 '17 at 13:18
  • I can't login in that link – Vamshi Dec 13 '17 at 17:25

1 Answers1

2

There are many examples in the AOT.

For example, table MarkupTrans has primary index TableRecIdIdx created from 3 fields (TransRecId, TransTableId and LineNum); table VendInvoiceInfoLine has primary index TableRefIdx created from 5 fields (TableRefId, ParmId, OrigPurchId, LineNum and RecId), etc.

10p
  • 5,488
  • 22
  • 30
  • Thanks I'll also refer some more example – Vamshi Dec 20 '17 at 18:11
  • I got my answer we have to create a index with 2 or more fields and set the allow duplicates to NO and alternate key to yes in the index then go to table properties and set the replacement key as your index. – Vamshi Dec 20 '17 at 18:14
  • 1
    Your question was about a primary key, not an alternate key. There is a maximum of one primary key per table, whereas a table can have several alternate keys. Replacement key is a different thing, it just defines what fields would appear on forms to helpfully identify each record. So your comment doesn't really answer your own question. More on the topic: https://msdn.microsoft.com/en-us/library/hh812105.aspx – 10p Dec 22 '17 at 09:45