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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Plugin and Custom workflow structure

(0) ShareShare
ReportReport
Posted on by 1,445

Hi,

I am planning to structure my code inside plugin and custom workflow, so that I don't have to push all my code into the Execute block. 

Do you have any suggestions (like using design patterns, dependency injection etc..) so that the code can be better structured and more readable?

Any code samples will be of real help.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Aiden Kaskela Profile Picture
    19,696 on at

    Hi,

    The scale of the supporting structure shouldn't eclipse the actual work you're doing for the plugins. I hate coming into a project where somebody over-architected a solution that is so configurable or structured that it's unusable.

    If you have a very large implementation, you can use a factory to get the right plugin for your code. So you just have one plugin class that uses a factory for "contact" and the "Pre-create" event, and the plugin passes it off to that class. It's a quick and easy way to isolate the different callout events.

    If it's small and you just have some shared functionality, create a base class for your common stuff or write extension methods to call into with your records.

    Hope this helps! I'd appreciate if you'd mark this as Answering your question.

    Thanks,

    Aiden

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans