Skip to main content

Notifications

Microsoft Dynamics 365 | Integration, Dataverse...
Answered

Retrieve data from external API and show its response within Dynamics 365

Posted on by 25

Hi there,

I am new to the Dynamics 365 customization.

I have recently received a request from a client that he wants to display data from an external API within

the Account or Opportunity form of Dynamics 365. The solution must be easily deployable because he wants to sell it

to other customers who might have the same need. Just for a clarification easily means, a non-technical

person could install the solution to his instance with just administrator rights.

I was thinking to use websource or iframe, however I might have the API tokens within the javascript code

which it will be a major security concern.

Could you please suggest me how should I continue with this task?

Thanks a lot for your support.

  • cloflyMao Profile Picture
    cloflyMao 25,198 on at
    RE: Retrieve data from external API and show its response within Dynamics 365

    Hi Gee1463,

    Hope those would help you.

    And I look forward to your feedback.  :)

    Regards,

    Clofly

    If you had found any answer helped, please kindly mark as verified to close the thread, it would be really appreciated.

    pastedimage1605670751804v2.png

  • Gee1463 Profile Picture
    Gee1463 25 on at
    RE: Retrieve data from external API and show its response within Dynamics 365

    Thank you so much for your details. I really appreciate this. I will try this out and let you know.

  • Verified answer
    cloflyMao Profile Picture
    cloflyMao 25,198 on at
    RE: Retrieve data from external API and show its response within Dynamics 365

    Hi Gee1463,

    > Steps for deployment if we use flow.

    1. In https://make.powerapps.com/, switch the environment to the environment that you use for importing data from external API, create a new solution.

    q0.JPG

    2. In the solution, create a flow component, and set up your flow in flow center.

    pastedimage1605519318143v1.png

    pastedimage1605519385326v2.png

    3. Back to solutions list, export the custom solution. (It depends on your own business requirement that exporting the solution as managed or unmanaged. See differences between them here.)

    pastedimage1605519457499v3.png

    4. In powerapps page of your customer, import the solution you built, it will ask customer to connect to their CDS account.(Dynamics account)

    q1.JPG

    5. Now customer can run your flow by opening your solution.

    pastedimage1605519743289v4.png

    > How to send data from the plugin to the web resource?

    Plugin will only be triggered when an account is created or updated, and it will just fetch data from external API.

    Therefore, you need to create a custom entity to save data from the external, then retrieve records of the custom entity with Web API and render result in web resource.  

    (It also applies with the flow way.)

    To sum up, either with flow or plugin:

    1. At lease a custom entity is required to be created to store external data as entity records.

    2. Create a solution to add the flow or plugin, then customers will able to run functionality by importing the solution directly.

    Regards,

    Clofly

  • Gee1463 Profile Picture
    Gee1463 25 on at
    RE: Retrieve data from API in Dynamics 365

    Hi Clofly,

    Thanks for your answer.

    Right yes. We need to make a call to an external API from Dynamics 365 and the data should be represented within Dynamics.

    I looked at the suggestion and the documentation you provided and it could work.

    However, how can I send data from the plugin to the webresource? The data from the plug in are that retrieved data from the API and I will need to display them on a scrollable list view in the websource. Can it be done like this?

    Another question, how can the solution that you suggested be deployed to customers? Can it be a package and just install it? Like an installation wizard or something?

    Thanks a lot for your contribution.

  • cloflyMao Profile Picture
    cloflyMao 25,198 on at
    RE: Retrieve data from API in Dynamics 365

    Hi Gee1463,

    So the real direction is from external API to Dynamics CRM instead, right?

    If so, you could create a HTTP trigger in flow to fetch data from the external API and send them to CRM with CDS connector.

    https://d365demystified.com/2020/04/07/make-http-request-from-flow-in-power-automate/

    (The flow will run recurrently.)

    In addition, it is also supported to get access to web resources by a plug-in, therefore, we can trigger the plug-in on creation or on update of Account entity.

    https://docs.microsoft.com/en-us/powerapps/developer/common-data-service/org-service/samples/web-access-plugin

    Regards,

    Clofly

  • Gee1463 Profile Picture
    Gee1463 25 on at
    RE: Retrieve data from API in Dynamics 365

    Hi Clofly,

    Thank you so much for your answer.

    The data that we will retrieve from the external API should be displayed in the Account form of Dynamics CRM.

    It will be a list of text and URL entries.

    I think the suggestions above would be the perfect solution if I would like to retrieve data from Dynamics to external source.

    Please correct me if I am wrong..As I said I am new here :)

    Again thanks for your answer.

  • cloflyMao Profile Picture
    cloflyMao 25,198 on at
    RE: Retrieve data from API in Dynamics 365

    Hi Gee1463,

    I would suggest you HTTP Request trigger to fetch data from Dynamics 365 and display to the external.

    https://d365demystified.com/2020/07/29/accept-http-requests-in-a-flow-and-send-response-back-power-automate/

    Then securing the endpoint with necessary validations:

    https://www.about365.nl/2018/11/13/securing-your-http-request-trigger-in-flow/

    https://demiliani.com/2020/06/25/securing-your-http-triggered-flow-in-power-automate/

    Regards,

    Clofly

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,228 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,056 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans