-
Notifications
You must be signed in to change notification settings - Fork 15
Tutorial 3
PhuocLe edited this page Mar 7, 2018
·
8 revisions
- End user add/edit Contact record which Job Title field have text: developer, automatic send an email to: admin@xxx.yyy.com
- Add PL.DynamicsCrm.DevKit > 18. C# Workflow Project to solution.
- A popup form opened.
- Select saved connection or create new connection.
- PL.DynamicsCrm.DevKit load all entities and bind to dropdown Project Name.
- Select
Contact
- Click
OK
- PL.DynamicsCrm.DevKit created custom workflow project name:
Wooow.Kool.Workflow.Contact
- Add PL.DynamicsCrm.DevKit > 10. C# Workflow Class to
Wooow.Kool.Workflow.Contact
project.- A popup form opened.
- Enter:
ValidateRegex
in the Class Name - Click
OK
- PL.DynamicsCrm.DevKit created class:
WooowKoolWorkflowContact_ValidateRegex
- Coding
[Input("String To Validate")]
public InArgument<string> StringToValidate { get; set; }
[Input("Match Pattern")]
public InArgument<string> MatchPattern { get; set; }
[Output("Valid")]
public OutArgument<string> Valid { get; set; }
private void ExecuteWorkflow(CodeActivityContext executionContext, IWorkflowContext workflowContext, IOrganizationServiceFactory serviceFactory, IOrganizationService service, ITracingService tracing)
{
tracing.Trace("Begin Execute Workflow: WooowKoolWorkflowContact_ValidateRegex");
var stringToValidate = StringToValidate.Get(executionContext);
var matchPattern = MatchPattern.Get(executionContext);
if (ValidateString(stringToValidate, matchPattern))
{
Valid.Set(executionContext, "1");
}
else
{
Valid.Set(executionContext, "0");
}
tracing.Trace("End Execute Workflow: WooowKoolWorkflowContact_ValidateRegex");
}
private bool ValidateString(string valString, string matchPattern)
{
Match match = Regex.Match(valString, matchPattern, RegexOptions.IgnoreCase);
return match.Success;
}
- Resolved errors and rebuild solution without errors.
- Open file
PL.DynamicsCrm.DevKit.Cli.json
by Notepad and edit these information in section:workflows.profile = "DEBUG"
workflows.solution = "Kool"
workflows.includefiles = "Wooow.*.dll"
- Open command-line, go to
Wooow.Kool.Workflow.Contact
folder, then rundeploy.bat
and waitingPL.DynamicsCrm.DevKit.Cli
deploy to Dynamics Crm. - Open
Plugin Registration Tool
and verify custom workflow deployed. - Go to Crm, open solution
Kool
and create a workflow that call this custom workflow - Check-in all files to your source control.
- You finished this tutorial.
Your Solution Explorer
after you finished this tutorial