Question

I have created a custom entity in MS CRM 4.0 and am trying to update a couple of the attributes via a custom worflow in .Net. I have read through several of the forums and blog posts and am still confused on how to access the custom entity and update some of their attributes.

I created a custom entity to replace how CRM was doing allotments as our company has some specific business rules that CRM wasn't doing. When a task is completed on an incident I want to update an attribute in the custom entity with the task duration. Any help would be greatly appreciated.

Thanks

Was it helpful?

Solution

When using the CRM web service in a custom workflow, you'll need to use DynamicEntity objects. The workflow context webservice is just an ICrmService so it doesn't know about your specific customizations. There's a pretty sample here: http://www.stunnware.com/crm2/topic.aspx?id=CustomWorkflowActivity

I imagine you could also add the CRM web services as a web reference to your workflow project. Then you'd have strongly types objects for your custom entities. I've never done this for my custom workflows, but it works for other custom apps accessing CRM.

OTHER TIPS

Choosing Dynamic Entities over WSDL in favour is always the better choice. When you develop a piece of code, you are more flexible with your classes. You could use your piece of software in different contexts for different systems. That's the reason Dynamic Entities were invented.

It's very easy and you dont'have to use DynamicEntity. You have to go to Settings -> Customization -> Download WSDL. Take the wsdl and use it in your project. Now you have all your custom entities strongly typed. All you have to do is to write something like this:

Guid entityId = getEntityId();
new_yourCustomEntity entity = new new_yourCustomEntity();
entity.new_yourCustomEntityid = entityId;
entity.new_customProperty = "value";
CrmService crmService = new CrmService();
crmService.Update(entity);

Maybe what you really mean is Custom Workflow Activity? This involves writing your own .NET class to add functionality to the standard CRM WF in form of new step types. If what you want to do is just to update an attribute you don't really need this, even if it is on a custom entity. The Update record step does just this and allows dynamic values (coming from other entities) to be specified.

Hope it helps

Daniel

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top