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
I have some data in another system that we use that has its own a web API. I want to sync data from it into CRM.
I'm thinking the best way to do that is making a JS web resource and assigning the function to the onLoad and onSave events. In the web resource it will handle the OAuth that the other system's web API uses, extract information from the active form to query the other API, and then use Dynamics' API to update the information. The other system is not customizable at all, so couldn't initiate anything from there.
Just checking if there is a better way?
Secondly, how can I trigger this on all records without having to open them and save them individually, thus trigger the onLoad and onSave events.
If you would like to fetch data from external web API, you can just add AJAX request in the assigned function.
For OAuth, firstly you would have to get access token with your client ID and client password(generally) from the other system to make authorized request.
Please read specific implementation that how does the external system make authentication.
Here is a demo with oauth authentication: (From https://docs.thecatapi.com/)
1. I create a vote for a cat called "abys".
2. I have to add my key(it was sent in my email from the website) in my vote querying request header otherwise I'll receive a 401 error.
For the second question, you could try to do your action and batch process in the back-end with workflow. So you will not to add it individually.
Since you are talking to external system, I would recommend you have your code that talks to external system in a Custom Workflow Activity (CWA). And then call this CWA in a workflow and this workflow can trigger on any record event to populate data from external system into a CRM record.
And if you want to apply the same to all the existing records, you can tick the On-Demand option in the workflow and use the XrmToolBox Bulk Workflow execution plugin to update all the records with external system data.
Note: One of the benefits to making this call from CWA is that you do not need to expose credentials or token in JS.
Thanks for the suggestion! I am not familiar with CWAs so have some research to do. Couple questions:
1. As far as not exposing credentials: would the credentials be assigned to some environmental variable in Dynamics or something to that effect?
2. Also, if using a CWA can it be scheduled to run a regular intervals?
Please see my suggestions or comments below
If your credentials will never change, you can actually hard code in your CWA code. But normally the credentials change for security reasons and there are few options as to how and where you can store the credentials so that it can be changed. One of the options is to have a settings entity and store your credentials in there and only give access this to this entity for necessary users. And in your CWA, you can get the credentials from the settings entity before you make calls to the external service.
2. Also, if using a CWA can it be scheduled to run regular intervals?
Yes. You can create waiting workflows in CRM that runs daily or any other interval you decide and in that workflow, you can call the CWA to perform the data sync.
Dynamics CRM does not natively have a schedule trigger for workflow and that's why we have to use waiting condition to run a workflow on a regular basis.
Some useful links to know learn about CWAs
Some useful links on scheduling workflows in CRM
Since CRM does not natively has a time-based trigger for a workflow, you could also consider executing a workflow using flow as described in the link below (this option is only recommended if you on CRM Online)
Business Applications communities