Skip to main content

Notifications

Customer experience | Sales, Customer Insights,...
Suggested answer

Unable to load custom view in lookup control of user subgrid button in Unified Interface using Javascript

Posted on by Microsoft Employee
I am using a user subgird on a form. In that subgrid, when clicked on 'Add existing users' "+" button, a lookup window pops up. When clicked on the lookup magnifying glass, we are trying to populate users only associated to a custom view.
We have implemented Javascript for this, where we are using addPreSearch and addCustomView methods, these are working as expected in classic interface, however, in unified interface, we are unable to populate the users related to custom view.
Has anybody experienced similar behaviour or found a fix in unified interface.
  • Jane88 Profile Picture
    Jane88 80 on at
    RE: Unable to load custom view in lookup control of user subgrid button in Unified Interface using Javascript

    Hi,

    Good day!

    Was the problem resolved? if Yes, I want to ask HOW.

    I have the same requirement and don't know how to achieve/implement it in Unified Interface. MS support suggests to use 'addCustomView' but how to identify the lookup control for user?

    Thanks

  • renton Profile Picture
    renton 205 on at
    RE: Unable to load custom view in lookup control of user subgrid button in Unified Interface using Javascript

    Hi Rantala

    Do you solve your problem.

    I have some same problem, and I ref the source code github.com/.../source_v9.js

    I can customize add existing button and add some customize filter and assoiciate the record add.

    But I can't add link-entity with N:N relationship which lookupObject can't find the relationship entity.

  • Vile Andreas Rantala Profile Picture
    Vile Andreas Rantala 1,255 on at
    RE: Unable to load custom view in lookup control of user subgrid button in Unified Interface using Javascript

    Hi Ankit, sorry to bother you... im trying to do the same that is mentioned in the article, but in my case my old fetchXML customview was having link entities, im not sure if with the lookupObjects i can add a secondary filter for the link entity... :/

  • Suggested answer
    RE: Unable to load custom view in lookup control of user subgrid button in Unified Interface using Javascript

    You need to write a javascript and register hat on Add existing Users button. In this javascript you need to launch the lookup modal window and set the parameters to it,as given in above document. We cannot locate the lookup window like that, as it is not supported to use any DOM objects.

    Hope this helps

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Unable to load custom view in lookup control of user subgrid button in Unified Interface using Javascript

    Lookup.PNG

    Thanks for your response, Ankit. There is a button "Add Existing user" on the subgrid. When clicked on this button, a lookup records window comes up, I want to map a view to that lookup control. I am unable to achieve that using Default view or using lookupObjects utility as I am unable to map them to that specific lookup control. 

    Need help in identifying that lookup control please.

  • Suggested answer
    RE: Unable to load custom view in lookup control of user subgrid button in Unified Interface using Javascript

    The approach which you are using is not correct, as you are using the DOM element to find the control. So in UCI and web client , it will be different and it will change, as UCI is totally designed on different framework as compared to web.

    You can achieve this requirement, either by creating a view for an entity and set it as a default view or if you want to use Javascript, then you need to register the javascript on add existing users button, which will show up look up modal.

    https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/xrm-utility/lookupobjects

    Hope this helps.

    Best regards,

    Ankit

    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.

     

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Unable to load custom view in lookup control of user subgrid button in Unified Interface using Javascript

    Hi Ankit,

    Thanks for your quick response.

    In order to use setDefaultView or addCustomView, i need to getControl of the lookup field. In the classic interface when i inspect element of the lookup field i get id: "lookup_users" and using it, I am able to get control and can utilize addPreSearch and addCustomView, to fulfill the requirement.

    However, in unified interface id shows as "lookupDialogLookup-MscrmControls.FieldControls.SimpleLookupControl-LookupResultsPopup_falseBoundLookup_8_textInputBox_with_filter_new" which I am unable to getControl of and use it to setDefaultView or addCustomView.

  • Suggested answer
    RE: Unable to load custom view in lookup control of user subgrid button in Unified Interface using Javascript

    Hy Bhskar,

    Hope this post finds you well and safe.

    Can you use setDefaultView() method for this look up to show you filtered view on lookup modal window.

    I am guessing that you have your own javascript registered on click on Add existing button on the subgrid, and trying to open a modal window and setting the filtered view in it.

    In that , can you please try to use the setDefaultView function.

    Thanks,

    Hope this helps.

    Best regards,

    Ankit

    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.

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!

Community AMA December 12th

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

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