Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Error on creating contact

Posted on by 12,070 Super User 2024 Season 1

Hi all

When I go to create contact. It is showing me this error:

aaaaaa.jpg

I enable trace. trace giving me following errors

ErrorInCreatingContact2.jpg

at EntityMetadataNotFoundException..ctor(String entityName, NameMappingType mapping) ilOffset = 0x1B
at DynamicMetadataCache.GetEntity(String entityName, NameMappingType mapping) ilOffset = 0x13
at User.HasPrivilege(String entityName, PrivilegeType privilegeType, PrivilegeDepth privilegeDepth, Boolean filterOfflinePrivileges, IOrganizationContext context) ilOffset = 0x0
at DisplayRuleEvaluator.EvaluatePrivilegeRulePart(PrivilegeRulePart rulePart, String primaryEntity, String currentEntity) ilOffset = 0x63
at DisplayRuleEvaluator.EvaluateRulePart(RulePart rulePart, String primaryEntity, RibbonTabInformation tabInfo, DisplayRuleInformation displayRuleInformation) ilOffset = 0x195
at DisplayRuleEvaluator.EvaluateRule(String primaryEntity, RibbonTabInformation tabInfo, DisplayRuleInformation trimRuleInformation) ilOffset = 0x4C
at RibbonDisplayRuleEvaluator.GetHiddenControls(Dictionary`2 controlMap, Dictionary`2 ruleDefinitions, String primaryEntity, DisplayRuleInformation trimRuleInformation, HashSet`1 webHiddenControls, HashSet`1 offlineHiddenControls, HashSet`1 onlineHiddenControls) ilOffset = 0x56
at RibbonDisplayRuleEvaluator.GetHiddenIds(HashSet`1 displayRuleIds, Dictionary`2 mapCommandToRule, RibbonTabInformation tabInformation, DisplayRuleInformation displayRuleInformation, HashSet`1 webHiddenControls, HashSet`1 offlineHiddenControls, HashSet`1 onlineHiddenControls, Dictionary`2 dynamicCommandDefinitions, Dictionary`2 dynamicCommandToControlMap, IOrganizationContext context) ilOffset = 0x52
at RibbonDescription.CalculateHiddenControls(DynamicMenuInformation dynamicMenuInformation, HashSet`1 currentTabCommands, RibbonTabInformation tabInformation, String entityLogicalName) ilOffset = 0x1C9
at RibbonDescription.AddCommandsForTab(String tabIdForFetch, String entityLogicalName, RibbonTabInformation tabInformation) ilOffset = 0xF0
at RibbonDescription.AddCommandsForTab(RibbonTabInformation tabStruct) ilOffset = 0x0
at RibbonDescription.AddTabs() ilOffset = 0x99
at RibbonDescription..ctor(RibbonPageContext pageContext, IOrganizationContext context, Boolean excludeTabs) ilOffset = 0x77
at RibbonData.GetRibbonDescription(PageResourceManager currentHeader, Boolean suppressTabs) ilOffset = 0x4B
at RibbonData.CreateClientControl(PageResourceManager currentHeader, Boolean suppressTabs) ilOffset = 0x2F
at AppHeader.ConfigureRibbonDataControl() ilOffset = 0x5B
at AppHeader.Render(HtmlTextWriter output) ilOffset = 0x6
at Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) ilOffset = 0x22
at Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) ilOffset = 0x51
at Page.Render(HtmlTextWriter writer) ilOffset = 0xE
at Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) ilOffset = 0x22
at Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) ilOffset = 0x8A4
at Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) ilOffset = 0x3C
at Page.ProcessRequest() ilOffset = 0x14
at Page.ProcessRequest(HttpContext context) ilOffset = 0x38
at CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() ilOffset = 0x187
at HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) ilOffset = 0x15
at ApplicationStepManager.ResumeSteps(Exception error) ilOffset = 0xF6
at HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) ilOffset = 0x5C
at HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) ilOffset = 0x15B
at HttpRuntime.ProcessRequestNoDemand(HttpWorkerRequest wr) ilOffset = 0x32
at ISAPIRuntime.ProcessRequest(IntPtr ecb, Int32 iWRType) ilOffset = 0x4B
Crm Exception: Message: The entity with a name = 'Contact' was not found in the MetadataCache., ErrorCode: -2147217150

What is wrong? Please help me.

Thank You

*This post is locked for comments

  • Suggested answer
    Nadeeja Bomiriya Profile Picture
    Nadeeja Bomiriya 6,804 on at
    RE: Error on creating contact

    Hi Abdul,

    I would try below steps one at a time to troubleshoot this kind of issues.

    1. Restart the CRM Server

    2. Then check if the services are running on the server.

    3. Turn off all plugins and workflows and then try creating the Contact again.

    4. If it works, then turn on one at a time or in batches until it starts to fail again to find the plugin or workflow with an issue.

    5. Check if the service accounts passwords has been reset or the accounts have been disabled.

    6. Examine, Event Viewer logs and trace logs.

    Cheers,

    Nadeeja

  • Suggested answer
    Nithya Gopinath Profile Picture
    Nithya Gopinath 17,074 on at
    RE: Error on creating contact

    Hi,

    Have you made any customizations to the contact entity? Also please retrieve the entity metadata and check if contact entity exists there. Please try the following code for retrieving entity metadata. 

    public static EntityMetadata[] GetEntities ( IOrganizationService organizationService)
    {
        Dictionary<string, string> attributesData = new Dictionary<string, string>();
        RetrieveAllEntitiesRequest metaDataRequest = new RetrieveAllEntitiesRequest();
        RetrieveAllEntitiesResponse metaDataResponse = new RetrieveAllEntitiesResponse();
        metaDataRequest.EntityFilters = EntityFilters.Entity;
    
        // Execute the request.
    
        metaDataResponse = (RetrieveAllEntitiesResponse)organizationService.Execute(metaDataRequest);
    
        var entities = metaDataResponse.EntityMetadata;
    
        return entities;
    }
  • Abdul Wahab Profile Picture
    Abdul Wahab 12,070 Super User 2024 Season 1 on at
    RE: Error on creating contact

    Hi Pawel Gradecki

    I also tried this way

    ErrorInCreatingContact4.jpg

    Thank You

  • Abdul Wahab Profile Picture
    Abdul Wahab 12,070 Super User 2024 Season 1 on at
    RE: Error on creating contact

    Hi Abed Haniyah

    No there is no custom workflow on contact entity. I create contact with the help of this code.

    Entity contact = new Entity("contact");

               contact["firstname"] = "Abdul";

               contact["lastname"] = "Wahab";

               Guid contactId = service.Create(contact);

    This code still creating contacts but from crm I am unable to create contacts.

    Thank You

  • tw0sh3ds Profile Picture
    tw0sh3ds 5,600 on at
    RE: Error on creating contact

    No, you are resetting website not IIS. On the left click on the "Win-US9********" and then on the right pane you will have option to reset web server not web site

  • Abdul Wahab Profile Picture
    Abdul Wahab 12,070 Super User 2024 Season 1 on at
    RE: Error on creating contact

    Hi Pawel Gradecki

    I restart my IIS with the help of this way

    ErrorInCreatingContact3.jpg

    Is it right?

    Thank You

  • Abed Haniyah Profile Picture
    Abed Haniyah 4,285 on at
    RE: Error on creating contact

    Could you share your custom workflow code?

  • tw0sh3ds Profile Picture
    tw0sh3ds 5,600 on at
    RE: Error on creating contact

    I mean IIS on CRM server, not your local IIS

  • Abdul Wahab Profile Picture
    Abdul Wahab 12,070 Super User 2024 Season 1 on at
    RE: Error on creating contact

    Hi Pawel Gradecki

    I restart my IIS but no success.

    Thank You

  • Abdul Wahab Profile Picture
    Abdul Wahab 12,070 Super User 2024 Season 1 on at
    RE: Error on creating contact

    Hi Pawel Gradecki

    I am creating contacts from visual studio in custom workflow and after creating contacts I have this issue. I think so. Did you mean I restart my IIS?

    Thank You

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