Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Email: LOOKUP CONTROL ERROR: Cannot add item of typename = to the lookup control

Posted on by Microsoft Employee

Hello,

I have an issue with email form after Update 1 was installed to our Dynamics CRM Online 2016 instance.

When I change something on the email form and hit save button, there is an alert error:

"LOOKUP CONTROL ERROR: Cannot add item of typename = to the lookup control."

Also, I noticed that "From" field is locked and I can't change its current value. If I enable it via JavaScript and click on the "Look Up More Records" button, I will see another alert: "You do not have sufficient privileges to open this Lookup dialog box." and also error message near save button: "LOOKUP CONTROL ERROR: Cannot add item of typename = to the lookup control".

My current user is System Administrator.

Please see screenshots.

Thank you

Email_5F00_Issue_5F00_1.png

Email_5F00_Issue_5F00_2.png

*This post is locked for comments

  • Sinisa Kezic Profile Picture
    Sinisa Kezic 20 on at
    RE: Email: LOOKUP CONTROL ERROR: Cannot add item of typename = to the lookup control

    "LOOKUP CONTROL ERROR: Cannot add item of typename = to the lookup control" sometimes happens when entityType that is to be added programmatically is not allowed to be assigned even with UI  to the field.

    E.g.: If you are adding custom entity reference to the lookup value of activity:regardingobjectid make sue that custom entity is enabled for activities or the error will appear.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Email: LOOKUP CONTROL ERROR: Cannot add item of typename = to the lookup control

    The suggestion from shwaa77 solved my issue. My issue didn't relate to email but to a contact lookup from a custom entity.

    Interestingly system doesn't appear to care whether there are {} around the guid or not - tried with and without. It was definitely the extra 's' on my entity name reference that caused it to fail.

  • thomasjs Profile Picture
    thomasjs User Group Leader on at
    RE: Email: LOOKUP CONTROL ERROR: Cannot add item of typename = to the lookup control

    I am using v9 in production. Installed the PowerObjectsWebTraffic solution (wrote something to the email entity). Then my email from got locked. Then i removed the solution (managed), and the problem was still there. 


    I created a support case with MS, and they confirmed this is a bug even for v9 that they are looking into. The problem being that the email entity isn't updating the configuration (XML). We tried importing several different XML, but it always alerts with same error when saving. They said it would be out in a release sometime soon. That would be for V9. 

  • Suggested answer
    Oztrea Profile Picture
    Oztrea 45 on at
    RE: Email: LOOKUP CONTROL ERROR: Cannot add item of typename = to the lookup control

    It's indeed a bug in CRM, we had the same issue even the format of the id is :

    String: The string representation of the GUID value for the record displayed in the lookup. The value should match the following format: {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}.

    (see in sdk: msdn.microsoft.com/.../gg334409.aspx)

    For Party lists (from, to,...) when we remove the braces XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX =>no more error :)

    Example if you want to set the current user id in the to when it's not set on load :

    var toAttr = Xrm.Page.getAttribute("to");
            if (toAttr && !toAttr.getValue())
                toAttr.setValue([
                {
                    id: Xrm.Page.context.getUserId().replace("{", "").replace("}", ""),
                    name: Xrm.Page.context.getUserName(),
                    entityType: "systemuser"
                }]);
  • Shwaa77 Profile Picture
    Shwaa77 175 on at
    RE: Email: LOOKUP CONTROL ERROR: Cannot add item of typename = to the lookup control

    I got the same error when adding Javascript to Update the price list automatically when the currency changes on an opportunity, It was a simple error on my side, the entyityType was set as "pricelevels" and it should have been "pricelevel".

    Assigning an Incorrect entitytype to a lookup.

    var object = new Array();
    object[0] = new Object();
    object[0].id = pricelevelid;
    object[0].name = name;
    object[0].entityType = "pricelevels";
    Xrm.Page.getAttribute("pricelevelid").setValue(object);

  • Suggested answer
    MBogan Profile Picture
    MBogan on at
    RE: Email: LOOKUP CONTROL ERROR: Cannot add item of typename = to the lookup control

    We notice same behavior after changing forms in an OnPrem environment from Legacy to turbo. While in Turbo form mode the Resolve email is no longer red and is throwing Lookup Control error. Switching back to Legacy fixes issue for now.

    I haven't tested the XML work around, but it must be stated that this is an unsupported fix and could break in future.

  • Vidyuth Profile Picture
    Vidyuth 55 on at
    RE: Email: LOOKUP CONTROL ERROR: Cannot add item of typename = to the lookup control

    We are on CRM Online 2016 Update 1 - From and Owner fields have lookuptype tag as mentioned in this blog. But I still receive this error. Unfortunately - I dont have a different environment to compare things. Can anyone assist what else to look for?

  • Oswin Profile Picture
    Oswin on at
    RE: Email: LOOKUP CONTROL ERROR: Cannot add item of typename = to the lookup control

    @Dmitry T Thanks for the solution, editing the xml worked for me!

    @Haruka Celeste Easiest way is to create a temporarily unmanaged solution and only add the email entity (if you're on CRM2016+ you can use the bare email entity and only add the from attribute).

  • RE: Email: LOOKUP CONTROL ERROR: Cannot add item of typename = to the lookup control

    I have same problem so I tried to configure Entity.xml but it seems there is no default attributes in it. I tried customizations.xml but still can't find them. Where can I find default attributes?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Email: LOOKUP CONTROL ERROR: Cannot add item of typename = to the lookup control

    Hello Madu,

    I used SolutionPackager from CRM SDK\Bin folder to unpack solution zip file and get Entity.xml file in Entities\Email folder.
     To unpack solution zip archive, you can run this command: solutionpackager /action:Extract /zipfile:Solution_Name.zip /folder:Solution_Name_Folder

    To build it back to archive: solutionpackager /action:Pack /zipfile:Solution_Name.zip /folder:Solution_Name_Folder

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans