Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

CRM 2016 Autocomplete | Retrieve properties of selected item

Posted on by Microsoft Employee

Hi there

I'm currently using the new Autocomplete dropdown to implement a couple features on the account form.

I think making a quick example would best depict the problem I'm facing.

Source Data: Records that hold information about local businesses in Dynamics CRM.

Sample Json:

[

{ name: "Shirt Center", location: "Sunrise Avenue 12", type: "B2C" },

{ name: "Shirt Center", location: "Beach Palace 234", type: "B2B" },

{ name: "Donut Paradise", location: "Nugget Plaza 99", type: "B2B" }

]

CRM Integration:

dropdown.png

Now here I have my lovely dropdown with the source data... I want to select the "Shirt Center" at "Beach Palace 234" which operates on a "B2B" basis.

Now we click there and...

coughtya_2D00_peeking.png

Which one is it? Clicking on an item just sets the value to the field and I have no information when retrieving the context (getEventSource()) to determine which one it was.

Is there a Dynamics CRM compliant solution to retrieve such information? 

Kind Regards,

Kim

*This post is locked for comments

  • RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: CRM 2016 Autocomplete | Retrieve properties of selected item

    Hi Amine,

    Can you share some more details on your solution and how it is different then the workaround mentioned above?

  • Amine Amine Profile Picture
    Amine Amine 130 on at
    RE: CRM 2016 Autocomplete | Retrieve properties of selected item

    Maybe it's too late, but this can help someone

    1 - you have to get the  Selected value  ID :

    to do that :  You add  AddOnChange   on your  field

    you get the selected value :   Xrm.Page.getControl(AttNAme).getAttribute().getValue();

    you search in your Json  for the Value, and you do whatever you want with it

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: CRM 2016 Autocomplete | Retrieve properties of selected item

    This was my original approach which is indeed dirty but I guess that's what we will be going for since the autocomplete implementation is half-arsed by Microsoft.

    Cheers Mr Kashyap

  • Verified answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: CRM 2016 Autocomplete | Retrieve properties of selected item

    Hi Kim,

    I had the same issue quite a while ago and searched the web for answers. I got the responses stating ' You need to write script on change of the field' but I couldn't figure out what do I need to write?  

    So I ended up implementing a dirty workaround mentioned below -

    1. Append the id with the name field

    2. Add the function on-change and get the selected value,

    3. Split the id & text and then set the text again on the field

    4. Retrieve the other information with the id and setting those values on other fields.  

    I am sure there must be some easy way to do this :)

    Hope this helps.

  • Syed Ibrahim Profile Picture
    Syed Ibrahim 6,257 on at
    RE: CRM 2016 Autocomplete | Retrieve properties of selected item

    In your scenario create a Master entity called "Businesses Info" with primary name fields as your name. rest all you create as attribute for the master entity. Add the master entity lookup in your Account form.

    Two approach to populate child entity values to Account form

    1. By Fields mapping

    Reference : blog.fullscope.com/save-time-entering-data-into-crm-by-mapping-fields-between-records

    2. By WebApi: Reference: saikrishnayadav.blogspot.sg/.../get%20data%20from%20parent%20record%20in%20child%20record%20using%20lookup

    Hope this helps. Pls mark it as verified to close the thread if suggestion resolved your query

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: CRM 2016 Autocomplete | Retrieve properties of selected item

    Hi,

    Sorry for you but it how automcomplete works.

    You should probably use lookups for your case. Then once you selected your Shirt center. You could run a retrieve request on the lookupid to find the additional information: community.dynamics.com/.../option-set-lookup-or-autocomplete

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!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans