The attribute with AttributeId = ‘guid’ was not found in the MetadataCache

I encountered this error when trying to export the solution from Dev environment. There was little information in the exception or the log file, but I could guess that something had been deleted and it didn’t update the MetadataCache (or the solution) somehow.

After googling, I found the solution is to delete the attribute/component from the CRM solution.

private static void RemoveComponentFromSolution(IOrganizationService service, Guid componentId, int componentType, string solutionName)
{
	RemoveSolutionComponentRequest removeRequest = new RemoveSolutionComponentRequest()
	{
		// this is the Guid you have found within your Dynamics 365 trace files
		ComponentId = componentId,
		ComponentType = componentType,
		// This is the unique name, not the display name of the solution you are trying to export
		SolutionUniqueName = solutionName
	};

	var response = service.Execute(removeRequest);
}

The component type can be retrieved using FetchXML

<fetch top="50" >
  <entity name="solutioncomponent" >
    <all-attributes/>
    <filter type="and" >
      <condition attribute="objectid" operator="eq" value="component guid here" />
    </filter>
  </entity>
</fetch>
Advertisements

Can’t set record Status Reason to default value in CRM Worklfow with Status Transition Rules Enabled

I encountered a weird case when trying to set record status reason to default value on creation of the record in CRM Workflow with Status Transition Rules enabled in the entity configuration. I’ll replicate the case and implement a workaround in my trial CRM Online instance. Continue reading “Can’t set record Status Reason to default value in CRM Worklfow with Status Transition Rules Enabled”

[Exp+1] Bug in Calculated and Rollup Fields

Security issues with calculated field and rollup field in CRM V9

I created a new CRM Online trial to try out latest features from July Update 2017. The version is 1612 (9.0.0.2090) (DB 9.0.0.2072) online.

When playing with calculated field and rollup field. I found errors in the two fields. I think they are bugs, but not sure if they are from the same root cause.
Continue reading “[Exp+1] Bug in Calculated and Rollup Fields”