Milos Nikolic Milos Nikolic - 1 year ago 74
C# Question

CRM: Difference between crating Workflow and Workflow custom activity in C#

I want to make workflow using C#.

I was searching about this and found that there are Workflows and Workflow custom activities.

Can someone tell me what is the difference between these two.

For example I have custom activity entity containing some products and i want to make a Workflow that would transform it to opportunity(by overriding default TO OPPORTUNITY custom button) and copy all the products to the new opportunity.

What should i use for this?

Answer Source

Both workflows and custom workflow activities are used to automate business processes. When a custom workflow activity can be used depends on the limitations of out of the box workflow and complexity of the business process. Something as little as calculations and as complex as calling a web service can only be done using custom workflow activities.

In your case, you need a plugin, not a workflow as the Convert To Opportunity is a CRM internal business process. Couple of options, choose one that best suits your scenario:

Option 1: Register a plugin on the post-update of the activity. Check to see if regardingobjectid attribute is updated, if the attribute exists it would mean the update was part of the convert operation. You can then update the opportunity(regardingobjectid) with the information you want.

Option 2: Register a plugin on create of an opportunity, query for all associated activities, if there is an associated activity, it was created by the convert operation.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download