Hi,
Does anyone know how to set the primary key in entities. I want to create an ID for each record in account, how can I set that field as the primary key?
Thank you in advance
*This post is locked for comments
Hi,
Does anyone know how to set the primary key in entities. I want to create an ID for each record in account, how can I set that field as the primary key?
Thank you in advance
*This post is locked for comments
Hi RachelleM,
You can create a key field this will be alternate key but wont be primary key but acts as primary key. As we can have only one Primary key.
Please follow below links to generate GUID dynamically.
https://weblogs.asp.net/haithamkhedre/generate-guid-from-any-string-using-c
http://www.c-sharpcorner.com/UploadFile/prasoonk/guids-in-C-Sharp-and-net/
Thanks
Hemant
If you are creating a new record in the system, it will automatically set the Guid for you, however, if you are importing data, and you want to set the Guid yourself you can do it either from the SDK (using C#/.NET code), by supplying the Guid of the record, or if you are using SSIS with KingswaySoft for example, you can specify the Guid of the record that you will be creating there.
Hope this helps.
Hey Rachelle,
When the Entity is created, it does have a already built Primary Field. You do not externally need to create it. Also when you create a record for a Entity, Guid (Id) will be also automatically set. But if you want to set a lookup filed Then you need Guid, Name and Logical Name of the record.
Below code might be of help!!!
var lookup = new Array(); lookup[0] = new Object(); lookup[0].id = recorid; lookup[0].name = recordname; lookup[0].entityType = entityname; Xrm.Page.getAttribute("attributename").setValue(lookup);
André Arnaud de Cal... 291,622 Super User 2024 Season 2
Martin Dráb 230,354 Most Valuable Professional
nmaenpaa 101,156