Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Javascript error in UI(HUB) to restrict partytype lookup to user entity

Posted on by Microsoft Employee

Hi Guys,

I have written a javascript to restrict partytype field to User entity

it is working fine in web but throwing error in UI, Here i am attaching JS for reference.

function SetDefaultToUser(executionContext) {
var formContext = executionContext.getFormContext();
formContext.getAttribute("optionalattendees").setLookupTypes(['systemuser']);

}

Error:

"formContext.getAttribute(...).setLookupTypes is not a function. " 

Thanks in advance

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Javascript error in UI(HUB) to restrict partytype lookup to user entity

    Thanks Andrew it solved my issue

  • Verified answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: Javascript error in UI(HUB) to restrict partytype lookup to user entity

    Hello,

    I believe you have this error because there is no such method for lookup attribute according to SDK. Similar method is available for lookup control - docs.microsoft.com/.../setentitytypes

    Try to use following:

    function SetDefaultToUser(executionContext) {

    var formContext = executionContext.getFormContext();

    formContext.getControl("optionalattendees").setEntityTypes(['systemuser']);

    }

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,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans