Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Answered

Setting lookup field value in JavaScript throwing error in uclient script

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I have a function to set a lookup field which works for the classic version of the form but not in the unified interface version.

This error is thrown in UI:  UciError: Value should be of type: entityType: Parameter Name: value[0].entityType


pastedimage1598449790679v1.png

The error appears to be thrown in one of the UCI scripts:

pastedimage1598450024494v2.png

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Setting lookup field value in JavaScript throwing error in uclient script

    Fantastic, thank you Andrew!  Oddly enough, this worked in the classic view.

  • Verified answer
    a33ik Profile Picture
    a33ik 84,325 Most Valuable Professional on at
    RE: Setting lookup field value in JavaScript throwing error in uclient script

    Thanks, that's the answer - don't use "Team", use "team". In the client scripts use lowercased entity names.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Setting lookup field value in JavaScript throwing error in uclient script

    var formContext = executionContext.getFormContext();
    var result = XrmServiceToolkit.Soap.Fetch(fetchXml);

    if (result.length > 0) {
       caseManagerTeamId = result[0].attributes["ofs_team"].id;
       caseManagerTeamName = result[0].attributes["ofs_team"].name;
    }

    setLookupField(formContext, "ofs_casemanagerteam", caseManagerTeamId, caseManagerTeamName, "Team");

  • a33ik Profile Picture
    a33ik 84,325 Most Valuable Professional on at
    RE: Setting lookup field value in JavaScript throwing error in uclient script

    Hello,

    Can you please provide the code that calls this setLookupField function?

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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,371 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans