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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Lookup Control Error: Cannot add item of typename= to the lookup control

(0) ShareShare
ReportReport
Posted on by 122

Trying to set regarding field in the email form. Script is setting the correct lookup field. But I am getting "Lookup Control Error: Cannot add item of typename= to the lookup control".

Anybody notice this issue?

Thanks

*This post is locked for comments

I have the same question (0)
  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    Can you please post code you use?

  • thomas.s Profile Picture
    122 on at

    var lkpEntityId=retrievedoData1 .results[0].ContactId;

    var lkpName=retrievedoData1 .results[0].FullName;

    var lookup=new Array();

    lookup[0]=new Object();

    lookup[0].id=lkpEntityId;

    lookup[0].name=lkpName;

    lookup[0].entityType="contact";

    lookup[0].type="lookup";

    Xrm.Page.getAttribute("regardingobjectid").setValue(lookup);  

    This is the specific code I am using. I am getting the contact name populating correctly, but I am getting the pop with that Lookup Control Error.

    Thanks

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Try to remove following line:

    lookup[0].type="lookup";

    there is no need in it.

  • kunalks2003 Profile Picture
    315 on at

    hi

    your code is working on my local machine can you please more detail like Crm version/event that you are using to fire the code.

  • thomas.s Profile Picture
    122 on at

    Removed that line and its still showing up the same error message.  On page load, its setting the correct contact, but when we click on the reply button or if we keep it open that email message page for long time, we will be able to see that error message.

  • thomas.s Profile Picture
    122 on at

    CRM 2016 8.1.0.359

    Script is running on page load.

  • kunalks2003 Profile Picture
    315 on at

    is this an on prem server?

  • kunalks2003 Profile Picture
    315 on at

    the error you are observing  is because of some other issue . this script is correct . also Microsoft does not support 8.1 any more so upgrading is the only option if its a product issue .

  • thomas.s Profile Picture
    122 on at

    Yes OnPrem

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at

    I don't think upgrade is the solution for this . I would suggest first select one contact manually in the regarding lookup  and then get the I'd,  name manually and make hard coded in below code. I am saying because seems the problem with the value you are passing here in below code.

    var lookup=new Array();

    lookup[0]=new Object();

    lookup[0].id=lkpEntityId; //Put here one existing hard code GUID

    lookup[0].name=lkpName; // put here one hard code name which you can select fro UI.

    lookup[0].entityType="contact";

    Xrm.Page.getAttribute("regardingobjectid").setValue(lookup);  

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
JS-09031509-0 Profile Picture

JS-09031509-0 3

#2
AS-17030037-0 Profile Picture

AS-17030037-0 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans