Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Autocomplete on external API call

(0) ShareShare
ReportReport
Posted on by 390

Hi All,

Is there anyway autocomplete functionality can be implemented from an external API call in dynamic, Like when typing, a prediction of result from the  remote server showed drop down in dynamic and then the user can pick one ?. Someone with better knowledge showed please help.

Thanks.

*This post is locked for comments

  • Victor Onyebuchi Profile Picture
    Victor Onyebuchi 390 on at
    RE: Autocomplete on external API call

    @ketan thanks buddy!. which i could implement the PCF solution, but time constraint, i need to deliver this for a client in a day, and the custom approach above wouldnt work n my case, as it doesnt download all the data as expected. I ahve marked the your approach as answer.

  • Suggested answer
    NODAL Profile Picture
    NODAL 860 on at
    RE: Autocomplete on external API call

    Hi Boss,

    Following link will help you get data from external api

    http://arpitmscrmhunt.blogspot.com/2015/03/call-external-web-service-using-custom.html?m=1

    Regards, 

    Ketan

  • Victor Onyebuchi Profile Picture
    Victor Onyebuchi 390 on at
    RE: Autocomplete on external API call

    Thank @ketan. At this point, i will go with your second option - "However with this approach you can fetch all data from external api using a custom action driven by a workflow.", , as i have no exeperience in creating my own managed solution. Would be in my to-do list though, to create my own solution. I can fetch all the data from the external api and then save them in an entity, use OOB autocomplete to lookup the entity. Any example (link) of how/where this action is executed ?

  • Suggested answer
    NODAL Profile Picture
    NODAL 860 on at
    RE: Autocomplete on external API call

    Hi Boss,

    Yes, to add new changes to solution you would need to build and package solution again.

    You can test your custom control before packing using following command.

    1) npm run build

    2) npm start

    Regards,

    Ketan

  • Victor Onyebuchi Profile Picture
    Victor Onyebuchi 390 on at
    RE: Autocomplete on external API call

    @ketan thanks for responding swiftly. since the index.ts is outside the solution file, it means any of my modifications wouldnt change anything in the solution right ?. sorry about all these questions, this is a diff level of coding for me. 

  • Suggested answer
    NODAL Profile Picture
    NODAL 860 on at
    RE: Autocomplete on external API call

    Hi Boss,

    Whichever fields you want to refer for a control you can declare that in a Menifest.xml as bound parameter.

    You could declare unbound parameters as well like flags, api url etc as input parameter.

    Changes in index.ts won't affect packaged solution which is ready for import.

    Regards,

    Ketan

  • Victor Onyebuchi Profile Picture
    Victor Onyebuchi 390 on at
    RE: Autocomplete on external API call

    Ketan A quick question, how do i reference a field that i need to pass in the API inside the index typescript file ?. And the index file isnt in the AutocompleteControl solution file that willl be inported into dynamics, would a ny change in the index file affect the solution, since the index file is outside the solution.

  • Suggested answer
    NODAL Profile Picture
    NODAL 860 on at
    RE: Autocomplete on external API call

    Hi Boss,

    It is not the case, you can have dynamic values for your custom control.

    You can refer same pcf control from pcf galary and retrieve data dynamically instead of pre defined.

    Refer code :github.com/.../Autocomplete

    In that cods in file index.ts

    Replace following line.

     var optionsPropValue = context.parameters.options.raw;

    Here you can call your api and get data and set response Jason as optionsPropValue.

    And in menifest.xml you can comment out following line.

    <property name="options" display-name-key="optionsValue" description-key="List of options separated by comma" of-type-group="optiondatatypes" usage="input" required="true" />

    Regards,

    Ketan

    If this helps, please mark verified.

  • Victor Onyebuchi Profile Picture
    Victor Onyebuchi 390 on at
    RE: Autocomplete on external API call

    @ketan, i saw this in one of the countrols Gallery - "A control to select a value from a predefined list of values and automatically filters the values based on what the user types.". Does it mean that external calls using an API cant be made ? I am completely new to PCF, never written a code to develop PCF before.

  • Suggested answer
    NODAL Profile Picture
    NODAL 860 on at
    RE: Autocomplete on external API call

    Hi Boss,

    You can find official documentation on below link.

    docs.microsoft.com/.../create-custom-controls-using-pcf

    Regards,

    Ketan

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,458 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans