-
Notifications
You must be signed in to change notification settings - Fork 15
Tutorial 5
PhuocLe edited this page Mar 8, 2018
·
10 revisions
- Automatic update latest value from Finance System to Annual Revenue field on Account.
- Open Crm solution
Kool
, then defineCustom Action
as below
- Add PL.DynamicsCrm.DevKit > 13. C# Custom Action Project to solution.
- A popup form opened.
- Select saved connection or create new connection.
- Leave blank in the Project Name
- Click
OK
- PL.DynamicsCrm.DevKit created custom action project name:
Wooow.Kool.CustomAction
- Add PL.DynamicsCrm.DevKit > 09. C# Custom Action Class to
Wooow.Kool.CustomAction
project.- A popup form opened.
- Select saved connection or create new connection.
- PL.DynamicsCrm.DevKit load all custom action bind to dropdown Message.
- Select
wo_AnnualRevenue
- Click
OK
- PL.DynamicsCrm.DevKit created custom action class:
PostAccountwo_AnnualRevenueSynchronous
- Always check PL.DynamicsCrm.DevKit created comment in your custom action class with
InputParameters
andOutputParameters
- PL.DynamicsCrm.DevKit created custom action class:
- Continue coding
private ParameterCollection ExecuteCustomAction()
{
var outputs = new ParameterCollection();
//YOUR CUSTOM ACTION BEGIN HERE
var target = (EntityReference)Plugin.Context.InputParameters["Target"];
var accountNumber = (string)Plugin.Context.InputParameters["AccountNumber"];
/*
Your code here to connect Finance System with target, accountNumber data.
This case the result always return value: 12345
*/
var annualRevenue = 12345;
//Update Annual Revenue data to Account
var account = new Account(target.Id);
account.Revenue = annualRevenue;
Plugin.Service.Update(account.GetUpdateEntity());
//Return data to Custom Action
outputs.Add(new KeyValuePair<string, object>("AnnualRevenue", annualRevenue));
return outputs;
}
- Rebuild solution without errors.
- Open command-line, go to
Wooow.Kool.CustomAction
folder, then rundeploy.bat
and waitingPL.DynamicsCrm.DevKit.Cli
deploy to Dynamics Crm. - We will this custom action in this tutorial ABCD
- Check-in all files to your source control.
- You finished this tutorial.
Your Solution Explorer
after you finished this tutorial