Work or School Accounts Now Enabled in Community!
On May 12 Work or School Accounts were enabled in Community, along with Microsoft accounts (MSA). This allows seamless navigation between Community, Dynamics 365 applications, and Azure Active Directory enabled sites while logged into your Work or School account.
Read more | Managing Accounts
Dynamics 365 2019 release wave 2 plan Discover the latest updates to Dynamics 365.Release Plan | Weekly Deployment Notes
Ace your Dynamics 365 deployment with packaged services delivered by expert consultants.Explore service offerings
Connect with the ISV success team on the latest roadmap, developer tool for AppSource certification, and ISV community engagements.
ISV self-service portal
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance and Operations TechTalks | Customer Engagement TechTalks | Talent TechTalks
Alternate keys are very powerful feature in Dynamics 365 / CRM. Especially when you are integrating with other systems it’s very helpful to use alternate keys to efficiently retrieve and update records. In this blog post I’ll guide you through creating alternate keys and using them in retrieving, updating and upserting records.
The first thing you need to do is to create a field that holds the alternate key. Please keep in mind that you can only use the field types: Decimal Number, Whole Number and Sinlge line of text for an alternate key. There’s also a maximum of five alternate keys per entity and a restriction in size. For a full reference visit the documentation.
When you created the field you need to go to the keys of the entity and create the alternate key. The key can be a combination of multiple fields. In this example I kept it simple by using one field:
For the key to work, a system job needs to run to create an index. Please check if this is successful. The key I created for this blog post had an error on the first try.
Setting the alternate key in the request is the same as setting the value of any other field:
"name": "Alternate key account",
"blg_alternatekey" : "blg12345"
Retrieving a record
Retreiving a record is quite simple. Normally you would use a get request to /account(0000-000-000-000-000) to retreive a single record using the guid of the record. Using an alternate key the request is this:
Here you can see that instead of using the guid, you need to use the field name of the key (not the keyname) and the value to retrieve the account.
The sample to update the record:
"name": "Alternate key account updated"
The nice thing with the PATCH request like this is, that by default it will update the account if it exists, or it will create the account if it doesn’t exist. This is a great feature for integration scenario’s with other systems.
You can also use the alternate key for setting a lookup value. In this example we will create a contact for the account created above.
"firstname" : "john",
"lastname" : "smith",
"firstname.lastname@example.org" : "/accounts(blg_alternatekey='blg12345')"
Alternate keys are a great feature, especially when you’re integrating with other systems. It’s good to see that the WebApi has full support for this, even with upsert requests and using it in navigation properties. This saves writing a lot of logic and a lot of calls getting guids from Dynamics365 / CRM.
The post Using alternate keys with the WebApi appeared first on Dynamics365Blog.nl by Marc Gerner.
Business Applications communities