-
Notifications
You must be signed in to change notification settings - Fork 14
Tutorial 1
PhuocLe edited this page Aug 23, 2018
·
25 revisions
- Lead can be import by Excel file and make sure the topic always uppercase after lead imported.
- Create a blank solution
Paz.LuckeyMonkey
- Add New Project
10. C# Shared Project
to solutionPaz.LuckeyMonkey
-
PL.DynamicsCrm.DevKit
createdshared project
name:Paz.LuckeyMonkey.Shared
with the following folders, filesEntities
-
Lib
Date.cs
EntityBase.cs
Extension.cs
PluginCore.cs
SimpleJson.cs
-
- Add New Project
03. C# Plugin Project
to solution.- A popup form Add new Plugin Project opened
- Click button
><
to create/select a Dynamics 365 connection - After connected
PL.DynamicsCrm.DevKit
loaded all entities and bind to dropdown Project Name - Select
Lead
in the Project Name - Select
9.0.2.4
in the Crm Version-
PL.DynamicsCrm.DevKit
get allMicrosoft.CrmSdk.CoreAssemblies
version fromNuGet
-
- Select
4.5.2
in the .Net version - Click
OK
-
PL.DynamicsCrm.DevKit
created plugin project name:Paz.LuckeyMonkey.Plugin.Lead
- Rebuild solution to restore
NuGet
packages - Add
2. C# Plugin Class
toPaz.LuckeyMonkey.Plugin.Lead
project- A popup form opened
- Click button
><
to create/select a Dynamics 365 connection -
PL.DynamicsCrm.DevKit
load all messages plugin for entityLead
and bind to dropdown Message. - Select Message:
Create
- Stage:PreOperation
. (It automatic selectedSynchronous
execution and not allow you change) - Click
OK
-
PL.DynamicsCrm.DevKit
created plugin class:PreLeadCreateSynchronous
- Open Windows Explorer, go to current solution folder, then goto
packages\tools\PL.DynamicsCrm.DevKit.Cli.[version]
folder. Copy file:PL.DynamicsCrm.DevKit.Cli.json
tosolution root folder
- Check solution root folder and you see 2 files:
PL.DynamicsCrm.DevKit.json
andPL.DynamicsCrm.DevKit.Cli.json
- Open file
PL.DynamicsCrm.DevKit.Cli.json
by Notepad and edit these information in section:plugins.profile = "DEBUG"
plugins.solution = "LuckeyMonkey"
plugins.includefiles = "Paz.LuckeyMonkey.*.dll"
- Rebuild solution
- Open command-line, go to
Paz.LuckeyMonkey.Plugin.Lead
folder, then rundeploy.bat
and waitingPL.DynamicsCrm.DevKit.Cli
deploy to Dynamics Crm - Open
Plugin Registration Tool
and verify plugin deployed - Open Crm solution
LuckeyMonkey
and verify pluginPaz.LuckeyMonkey.Plugin.Lead
added toPlug-in Assemblies
node, stepPaz.LuckeyMonkey.Plugin.Lead.PreLeadCreateSynchronous
added toSdk Message Processing Steps
node - Add
PL.DynamicsCrm.DevKit
>21. C# Late Bound Class
toEntities
folder ofWooow.Kool.Shared
project.- A popup form opened.
- Select saved connection or create new connection.
-
PL.DynamicsCrm.DevKit
load all entities and bind to dropdown Class.
-
- Select
Account
in the class. - Click
OK
and waiting. 2 files generated.-
Account.cs
you can edit/update your code here because it is a partial class. -
Account.generated.cs
DON'T changes this file, it will be lost when you re-generateAccount
entity.
-
- Rebuild solution and get an error missing
EntityBase
class. - Add
PL.DynamicsCrm.DevKit
>22. C# EntityBase.cs
toLib
folder ofWooow.Kool.Shared
project. - Rebuild solution without errors.
- Back to class:
PreAccountCreateSynchronous
and beginning code- Go to line 30, remove comment code, edit fixed it like below
var target = (Entity)Plugin.Context.InputParameters["Target"];
- Continue write your code
//YOUR PLUGIN-CODE GO HERE
var account = new Account(target);
if (account.Name != null)
account.Name = account.Name.ToUpper();
- run
deploy.bat
again to deploy new code to your Dynamics Crm. - Go to Dynamics Crm, create new
Account
to check plugin worked or not. - Check-in all files to your source control.
- You finished this tutorial.
Your Solution Explorer
after you finished this tutorial