Integrating Dynamics 365 CRM with MuleSoft Using a Synchronous C# Plugin
ππ Step 1: Set Up Your C# Plugin in Dynamics 365 CRM
1️⃣ Create a New C# Plugin Project in Visual Studio
- Open Visual Studio → Create a Class Library (.NET Framework) Project
- Install the Microsoft.CrmSdk.CoreAssemblies NuGet package
- Add a new class called
LeadCreatePlugin.cs
π Step 2: Write the Synchronous C# Plugin Code
πΉ Plugin Code to Capture New Leads & Send Data to MuleSoft
π Step 3: Deploy the Plugin in Dynamics 365 CRM
1️⃣ Sign & Build the Plugin DLL
- In Visual Studio, go to Project Properties → Signing → Enable Sign the Assembly
- Build the Project (
Ctrl + Shift + B
) → This will create a.dll
file
2️⃣ Register the Plugin in Dynamics CRM
- Open Plugin Registration Tool
- Click Register New Assembly → Upload your
.dll
file - Click Register New Step
- Message:
Create
- Primary Entity:
lead
- Execution Mode:
Asynchronous
(Recommended) orSynchronous
- Stage:
Post-operation
- Message:
π Step 4: Test the Integration
πΉ Create a Lead in Dynamics 365
- Go to CRM → Sales → Leads
- Click New, fill in details & save
- The Plugin will send the Lead Data to MuleSoft API
π― Summary – What We Achieved?
✅ Captured New Leads in CRM using a C# Plugin
✅ Sent Lead Data to MuleSoft via an API (without async/await)
✅ Deployed & Tested the Integration
Now, whenever a new Lead is created, the data is automatically sent to MuleSoft, which can then forward it to any other system (like SAP, Salesforce, or a database).
π Want real-time updates? Use Webhooks in CRM to call MuleSoft instantly instead of using a plugin!
Comments
Post a Comment