-
Notifications
You must be signed in to change notification settings - Fork 14
Tutorial 1
PhuocLe edited this page Mar 6, 2018
·
25 revisions
- Account Name always uppercase
and don't allow user edit it.
- Add PL.DynamicsCrm.DevKit > 15. C# Shared Project to solution.
- PL.DynamicsCrm.DevKit created shared project name:
Wooow.Kool.Shared
- PL.DynamicsCrm.DevKit created shared project name:
- Add PL.DynamicsCrm.DevKit > 14. C# Plugin Project to solution.
- A popup form opened.
- Click button
><
(right of Project Name) to create a Dynamics 365 connection. After connected. Click OK to confirm used this connection.- PL.DynamicsCrm.DevKit loaded all entities and bind to dropdown project name.
- Select
Account
in the project name dropdown. - Select Crm Sdk Version
- PL.DynamicsCrm.DevKit get all
Microsoft.CrmSdk.CoreAssemblies
version from NuGet - Click right button
><
to make default select.
- PL.DynamicsCrm.DevKit get all
- Select .Net version
- 4.5.2 or 4.6.2
- Click right button
><
to make default select.
- Click OK
- PL.DynamicsCrm.DevKit created plugin project name:
Wooow.Kool.Plugin.Account
- Rebuild solution to restore NugGet packages and check solution rebuild all succeeded.
- Add PL.DynamicsCrm.DevKit > 08. C# Plugin Class to project
Wooow.Kool.Plugin.Account
- A popup form opened.
- Select saved connection or create new connection.
- PL.DynamicsCrm.DevKit load all messages plugin for entity
Account
and bind to dropdown Message.
- PL.DynamicsCrm.DevKit load all messages plugin for entity
- Select Message:
Create
- Stage:PreOperation
. (It automatic selectedSynchronous
execution and not allow you change) - Click OK
- PL.DynamicsCrm.DevKit created plugin class:
PreAccountCreateSynchronous
- Rebuild solution and received errors.
- Add PL.DynamicsCrm.DevKit > 20. C# PluginCore.cs to
Lib
folder ofWooow.Kool.Shared
project. - Back to
PreAccountCreateSynchronous
class and add missing using. - Rebuild solution without errors.
- 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
to solution 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 = "Kool"
plugins.includefiles = "Wooow.*.dll"
- Open command-line, go to
Wooow.Kool.Plugin.Account
folder, then rundeploy.bat
and waitingPL.DynamicsCrm.DevKit.Cli
deploy to Dynamics Crm. - Open
Plugin Registration Tool
and verify plugin deployed or not ! - Open Crm solution
Kool
and verify pluginWooow.Kool.Plugin.Account
added toPlug-in Assemblies
node and stepWooow.Kool.Plugin.Account.PreAccountCreateSynchronous
added toSdk Message Processing Steps
node. - Add PL.DynamicsCrm.DevKit > 21. C# Late Bound Class to
Entities
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 dropdown. - 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 lost when you re-generatedAccount
entity.
-
- Rebuild solution and get an error missing *
EntityBase
class - Add PL.DynamicsCrm.DevKit > 22. C# EntityBase.cs to
Lib
folder ofWooow.Kool.Shared
project. - Rebuild solution without errors.
- Back to class:
PreAccountCreateSynchronous
and beginning code here- Always remember check the comment section in the plugin class that PL.DynamicsCrm.DevKit help you for
InputParameters
andOutputParameters
. It help you known theKey
andData Type
. - Go to line 30, remove comment code, edit fixed it like below
- Always remember check the comment section in the plugin class that PL.DynamicsCrm.DevKit help you for
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 test by create Account.
- Check-in all files to your source control.
- You finished this tutorial.
Your Solution Explorer after you finished this tutorial