web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

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

(0) ShareShare
ReportReport
Posted on by
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.
I have the same question (0)
  • Suggested answer
    Ankit Sabharwal Profile Picture
    on at
    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.

  • Community Member Profile Picture
    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
    Ankit Sabharwal Profile Picture
    on at
    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
    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
    Ankit Sabharwal Profile Picture
    on at
    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

  • Vile Andreas Rantala Profile Picture
    1,257 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... :/

  • renton Profile Picture
    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.

  • Jane88 Profile Picture
    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

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 228

#2
Tom_Gioielli Profile Picture

Tom_Gioielli 156 Super User 2025 Season 2

#3
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 149

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans