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

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

Changing the underlying lookup View for a lookup (contact) field on Case Form

(0) ShareShare
ReportReport
Posted on by 1,577

Hello,

I am creating a custom "Case" form and I wanted to change the underlying View for the contact lookup field (primarycontactid). I created a new System View with the filter I required and then selected this as the default View for the lookup. However when I search the lookup it always returns "No records found"

However, there is another lookup field on the Case form called "new_notified_contact" and when I change the underlying view here it works!

Does anyone know what the difference is? I want to be able to have a parent customer but an associated contact - but restrict the lookup to that contact to a certain set of criteria rather than search all contacts.

Alternatively, Is there any way to change the default lookup view for customerid lookup so it just defaults to a custom (contact-only, rather than account) view?

Thanks for your help.

- Seamus

I have the same question (0)
  • Suggested answer
    LeoAlt Profile Picture
    16,331 Moderator on at

    Hi Partner,

    1.Please go to contact entity list and select the new view you created to check if there is any record.

    You could also share more details with screenshots so that we could do more  troubleshooting for you.

    2.If you want to change the look up field view dynamically, you should use JS code.

    formContext.getControl(arg).setDefaultView(viewId);

    https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/controls/setdefaultview

    Regards,

    Leo

  • Suggested answer
    Bipin D365 Profile Picture
    28,983 Moderator on at

    Hello,

    Make sure you have added newly created view in App through App designer.

    Please mark my answer verified if i were helpful

  • Community Member Profile Picture
    on at

    Hello, I have exactly the same problem except that I need to limit the view to accounts, not contacts. 

    "parentcustomerid" is the "Customer" field on my form

    "a9af0ab8-861d-4cfa-92a5-c6281fed7fab" is guid for the Account lookup view

    when my form loads I run the following code to change the default view, with appropriate parameters:

    function(executionContext, lookupId, viewGuid) {
    var formContext = executionContext.getFormContext();
    formContext.getControl(lookupId).setDefaultView("{" + viewGuid + "}");
    }

    .... and I can see from the browser console that, indeed, the default view of "parentcustomerid" becomes "a9af0ab8-861d-4cfa-92a5-c6281fed7fab"

    pastedimage1614862442826v1.png

    no error from Dynamics, everything fine, success then? Nope! The view displayed in the UI (the same browser as the console from screenshot above) is still that "customer lookup view" that lets users choose among accounts and contacts; not the "Account lookup view"!

    pastedimage1614862685512v2.png

    Any idea why?

  • Seamus Profile Picture
    1,577 on at

    Hello, I think that is as far as it lets you go - then you have to select contacts or accounts. That is what I have to do but as soon as I select contacts it gives me the correct view. When you click on "change view" and select accounts, is the one marked "(default)" the one you ecpect to see - the account view with the guid you specified?

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 96 Super User 2025 Season 2

#2
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 49 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans