Is it possible to write a workflow that can be triggered for many entities in CRM.
The answer is yes. You can do that.
Rather than writing several workflows to get this done you can write one workflow and then use a variable for flag here.
I have listed below a sample workflow.
protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
{
try
{
Guid ID1 = ((SDK.Lookup)base.GetValue(ID1Property)).Value;
string Type = ((String)base.GetValue(TypeProperty));
Guid _iID = Guid.Empty;
switch (Type)
{
case "1":
_iID = ((SDK.Lookup)base.GetValue(iIDProperty)).Value;
break;
case "2":
_iID = ((SDK.Lookup)base.GetValue(pIDProperty)).Value;
break;
case "3":
_iID = ((SDK.Lookup)base.GetValue(qIDProperty)).Value;
break;
case "4":
_iID = ((SDK.Lookup)base.GetValue(fIDProperty)).Value;
break;
}
IContextService contextService = (IContextService)executionContext.GetService(typeof(IContextService));
IWorkflowContext context = contextService.Context;
}
catch (Exception ex)
{
}
return ActivityExecutionStatus.Closed;
}
as for this example we need to create 4 dependency properties. they are
iIDProperty, pIDProperty, qIDProperty, fIDProperty.
depending on what we get for the switch statement the relevant dependency property would get updated.
This blog describes mostly about the work (CRM 365, CRM 2016, CRM 2015, CRM2011, CRM 4.0, CRM 3.0, C#,Javascript and SQL Server) i do.
Subscribe to:
Post Comments (Atom)
Retrieving Calendar of a Bookable Resource in Dynamics
There are occasions where we need to retrieve working days and working times of a resource in Dynamics grammatically. This is quite possible...
-
There is a bit of change in CRM 2011 than CRM 4. The code is below. Microsoft.Xrm.Sdk. EntityReference Moniker1 = new Microsoft.Xrm.S...
-
When you create a new security role from scratch and then assign only that role to a system user and when you log to the CRM site you might ...
-
There are occasions where we need to retrieve working days and working times of a resource in Dynamics grammatically. This is quite possible...
No comments:
Post a Comment