Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Using Alternate key to update Entity Record Microsoft Dynamics CRM 2015 Update 1
WhatsApp
Mahender Pal
9y
16.4
k
0
3
25
Blog
If you have worked on integrating CRM with another system like ERP, you might have maintain different keys for your ERP records for the synchronization purpose. But now you do need to that any more !! Microsoft Dynamics CRM 2015 Update 1 introduced new feature which allows us to assign alternate unique keys to entity which can help us to update entity record, this is specially useful for integration because you need to keep both keys from both the system to synchronization of the data between two systems. This key can help you to create/update data in CRM without querying entity record primary GUID, which means alternate key will act like a primary key. You can add alternate keys by following below steps.
Navigate to
Settings-> Customizations->Customize the System.
Select your entity and expend it, let’s say in our case we want to use
Account
entity.
Click on
Keys->New
to setup alternate key for account.
Provide display name for your alternate key, let’s say we want to name it as
Integration key.
Select source field where want to store this key, so let’s say want to utilize
Account Number field
, select
Account Number
and click on
Add
button.
Save and Close
key dialog.
Now this field will be holding another key field for us that we can use to update this record. So let say first we want to create account record and by setting this key, we can use following code:
//Create Account object with alternate key field and value
Entity account =
new
Entity(“account”, “accountnumber”, “ERP12345″);
account[“name”] = “Alternate Key Test”;
service.Create(account);
So our account record is created like below.
Now as this account is created with alternate key, we can simply update this account with the help of alternate key without using accountid field (primary key) like below:
Entity accountUpd =
new
Entity(“account”, “accountnumber”, “ERP12345″);
accountUpd[“name”] = “Alternate Key Demo”;
accountUpd[“websiteurl”] = “www.himbap.com”;
service.Update(accountUpd);
Now our account record is updated.
So, we can use alternate keys to update entity records now !!
HIMBAP
| Need any help in Microsoft CRM 2015 Development
Contact US
.
Microsoft Dynamics CRM
CRN
Up Next
Generate PDF File Using JavaScript in Microsoft Dynamics CRM 2015
Ebook Download
View all
Printing in C# Made Easy
Read by 22.3k people
Download Now!
Learn
View all
HIMBAP
We are expert in Microsoft Power Platform.
Membership not found