CRM 2011 plugin error: Query builder error, the specified record type does not exist in Microsoft Dynamics CRM

Answered CRM 2011 plugin error: Query builder error, the specified record type does not exist in Microsoft Dynamics CRM

  • Monday, January 07, 2013 2:52 PM
     
     

    In one of my custom entity I need to set up a campaign entity, which is a look up in my custom entity. When I am trying to set this in plugin I am getting this query build error.

    My code looks follows: It is getting the correct campaign, while saving the changes it is giving that error

    Entity

    entity = (Entity)pluginExecContext.InputParameters["Target"];        

               

    varcampaign = GetCampaignID();

               

    EntityReferencecampaignRef = newEntityReference("Campaign", campaign.Id);

               

                entity.Attributes.Add(

    "cdi_campaignid", campaignRef);

               

                orgServiceContext.SaveChanges();

All Replies

  • Monday, January 07, 2013 3:40 PM
    Moderator
     
     Proposed Answer

    EntityReferencecampaignRef = newEntityReference("Campaign", campaign.Id);

    This should be the following I think.

    EntityReferencecampaignRef = newEntityReference("campaign", campaign.Id);

    I'm not sure why you are calling orgServiceContext.SaveChanges(); but if you have this plugin in the prestage mode transaction you only need to update your inputparameter entity for the campaign value to be saved using the standard system save.


    MS CRM Bing'd - http://bingsoft.wordpress.com
    Dynamics XRM Tools CRM 4 to CRM 2011 JavaScript Converter Tool
    CRM 2011 OData Query Designer
    CRM 2011 Metadata Browser
    CRM Forum Guidance

  • Monday, January 07, 2013 3:45 PM
     
     

    check

    if(entity.attrribute.contain("campaign"))

    entity["campaign"]="";

    else

    {

      entity.Attributes.Add("cdi_campaignid", campaignRef);

    }

    fire this in pre-operation stage ,message=update

    if like to update the entity


    ms crm

  • Tuesday, January 08, 2013 8:44 PM
     
     Answered
    Thanks for the reply, I resolved the problem by changing the new EntityReference("campaign", campaign.Id) to newEntityReference(Campaign.EntityLogicalName, campaign.Id) and instead of calling orgServiceContext.SaveChanges() to OrgService.Update(entity).
  • Tuesday, February 19, 2013 11:40 AM
     
     

    Hi,

    i am also facing the same issue,in Microsoft dynamics crm.In the Sales pane i have added the "Notes" entity by editing the customizations file. now the "Notes" entity is displaying in the sales pane. Earlier it is worked fine, when the crm is upgraded to Polaris version it is this error. then, while i am clicking on 'new'  button it is displaying the following error.

    how to resolve this error. any help will be greatly appreciated.

    Thanks in Advance.


    Nagaraj