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

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

'[MyWorkflowsNamespace].Entities.BusinessUnit' is not a known entity type

(0) ShareShare
ReportReport
Posted on by 10

I have Workflows and Entities project withing my VS solution. Entities.cs file under Entities project is autogenerated using CrmSvcUtil.exe, containing early bounded entitiies.

I need to have BusinessUnit, Organization and etc. types in my CodeActivity workflow.For this purpose I added Entities folder under Workflows project and within it Entities.cs file has been added as a link (tried also with adding Entities dll as reference - same result) and I have the following code:

all needed using were added

using (var dataContext = new CrmDataContext(service))
{
	BusinessUnit businessUnit = dataContext.BusinessUnitSet.Where(o => o.Id == businessUnitId).FirstOrDefault();

	if (businessUnit != null)
	{
		Organization orgSetting = dataContext.OrganizationSet.Where(o => o.Id == businessUnit.OrganizationId.Id).FirstOrDefault();

		if (orgSetting != null)
		{
		    //some logic here
		}
	}
}

In CRM using my CodeActivity in custom workflow I have the following error:

The specified type '[MyWorkflowsNamespace.Entities.BusinessUnit' is not a known entity type.Code

I googled it and found that adding [assembly: Microsoft.Xrm.Sdk.Client.ProxyTypesAssemblyAttribute() to AssemblyInfo should help, but it didn't.

My guess is that somhow CrmDataContext is not being initialized correctly. But here my knowlege is limited and I don't know what to look for.
Have any of you experienced this issue? What could possibly cause such?

I have the same question (0)
  • Suggested answer
    Mr. Anton Profile Picture
    10 on at
    RE: '[MyWorkflowsNamespace].Entities.BusinessUnit' is not a known entity type

    Allright, found the issue myself.

    Changed 

    var dataContext = new CrmDataContext(service)
     to 
    CrmDataContext dataContext = new CrmDataContext(service)
     Helped for me, as always the issue in in details, no need to dig dipper 

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Sahan Hasitha Profile Picture

Sahan Hasitha 169

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 67 Super User 2025 Season 2

#3
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 65

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans