This article assumes you already have a working Dynamics 365 application and a Betty Blocks application ready for use.
Login to Azure Portal ( Use the same credentials as your Dynamics account, if it asks you to sign up and setup trial, you can do that)
Once you have logged in, Navigate to the option “Azure Active Directory” and click on “App registration
Click on “New application registration”.
Add the name of the application and select the Application type as “Web App / API”.
In the Sign-ON URL field enter the following URL: https://<appname>.bettyblocks/oauth2/callback
It will take some and create the application for you ( Note down the Application ID , you would need it when connecting to Dynamics).
Click on the Settings from the application created and then on Required Permissions:
Now Click on Add.
Select Dynamics CRM Online from Drop Down and click on select:
It will move to the next step “Select Permissions“, select the “Access Dynamics CRM as organization users” option and click on Select again.
Click on Done. It will take some time.
Next thing that we need is a API key. Open the Settings -> API ACCESS -> Keys.
Enter a Description and fill the Expires fields.
Copy the generated key value. You won't be able to retrieve it later.
This part is done! The setup is completed , now you can use this app’s Application ID as a Client ID in your Betty Blocks application.
Now create a new webservice in your Betty Blocks application. The
hostfield is <add your environment name, like ‘myorg.crm’>.dynamics.com.
After saving the webservice, open the generated authentication settings. Give the authentication a friendly name, use these settings:
Authorization uri: https://login.microsoftonline.com/common/oauth2/authorize?resource=https://<add your environment name, like ‘myorg.crm’>.dynamics.com
Token credential uri: https://login.microsoftonline.com/common/oauth2/token
Client: the application ID that we previously wrote down.
Client secret: the generated password that we previously wrote down.
After saving the authentication, press 'Connect'. You will be redirected.
Press 'Accept'. If everything is OK you will be redirect back to your Betty Blocks application.
With our authentication in place we can go back to our webservice definition and add a test endpoint. We will create a GET endpoint to fetch all the accounts in our Dynamics CRM. We use the path '/api/data/v9.0/accounts'.
After saving the endpoint we can use the 'Run test' button to make sure that everything works as expected.
Luckily everything works fine! We successfully fetched all the accounts in our Dynamics CRM.
To do something with the result of the webservice you can follow the general webservices tutorial.