简体   繁体   中英

CRM: Difference between creating 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.

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM