locked
Upgrade Custom Workflow activities with CRM Date Time - Problem with existing workflows RRS feed

  • Question

  • We are upgrading from CRM 4 to CRM 2011

    We have Custom Workflow Activities - many of which take input parameters of type CRMDateTime

    We can upgrade the Custom Workflow activity code to work under CRM 2011 (using DateTime as a parameter)

    But we have a problem with existing workflow definitions which use our Custom Workflow Activities. When we migrate the organisation onto our 2011 server, the workflows import without raising errors but the parameter values on the Set Custom Step Input Properties screen have been cleared.

    Later steps which use the Form Assistant to access the output from the custom activities also fail (the Set Properties button is just disabled)

    So  basically we have no problem upgrading the code and making it work under 2011 - the issue is with persisting current workflows that use the custom activities. Workflows which do not use the custom activities upgrade without any issues.

    Can anyone shed any light on this.

    Thanks

    Paul

    Monday, August 11, 2014 10:29 AM

All replies

  • Sounds like the workflows that use Inputs/Outputs of type CRMDateTime need to be recreated.  If that would be too time-consuming and complex, you could try editing the workflow .xaml files of an exported solution to switch the Inputs/Outputs to type DateTime before trying to re-import.

    Monday, August 11, 2014 1:11 PM
  • Thanks for the reply.

    I definitely want to avoid recreating the workflows (if possible) due to the number of them. I can fix the problems via the UI - although your suggestion of editing the XAML may well be easier. We are importing the CRM 4 organisation into 2011 to perform the upgrade - so there is no XAML at this point, but post upgrade I could put the workflows into a solution, fix the problems and then re-import.

    However I am not sure where all of this leaves currently running instances of these workflows.

    I have just tried importing an organisation which has running instances of the workflows which use the custom activities and I get errors (mport of organisation fails)

    The log gives:

    Error - Workflow instance xxxx failed upgrade with exception: System.Activities.InvalidWorkflowException: The following errors were encountered while processing the workflow tree:

    'DynamicActivity': The private implementation of activity '1:  DynamicActivity' has the following validation error:  Compiler error(s) encountered processing espression "DirectCast(CustomActivityStep4OutputDate_localParameter, System.DateTime)". Value of Type 'Microsoft.Crm.Sdk.CrmDateTime' cannot be converted to Date.

    'DynamicActivity': The private implementation of activity '1:  DynamicActivity' has the following validation error:  Compiler error(s) encountered processing expression "DateTime.UtcNow >= DirectCast(CustomActivityStep4OutputDate_localParameter, System.DateTime).ToUniversalTime()". Value of type 'Microsoft.Crm.Sdk.CrmDateTime' cannot be converted to 'Date'.

    'DynamicActivity': The private implementation of activity '1:  DynamicActivity' has the following validation error: Compiler error(s) encountered processing expression "CustomActivityStep4OutputDate_localParameter". Invalid L-value expression. :Reference expressions cannot end with conversion. The provided expression's type must exactly match the type T of VisualBasicReference<T> or LambdaReference<T>.

    at System.Activities.Hosting.WorkflowInstance.ValidateWorkflow(WorkflowInstanceExtensionManager extensionManager)

    at System.Activiites.WorkflowApplication.EnsureInitialized()

    at System.Activities.WorkflowApplication.Enqueue(InstanceOperation operation, Boolean push)

    at System.Activities.WorkflowApplication.WaitForTurn(InstanceOperation operation, TimeSpan timeout)

    at System.Activities.WorkflowApplication.InternalRun(TimeSpan timeout, Boolean isUserRun)

    at Microsoft.Crm.Tools.Admin.WorkflowInstanceUpgradeWorker.Upgrade(Guid asyncOperationId, String workflowState, List 1 lastLogs, DynamicActivity activity, String& networkFlowState)

    at Microsoft.Crm.Tools.Admin.WorkflowInstanceUpgrader.Upgrade(IEntityRecord data, Boolean& succeded).

    So basically at the moment to be able to import my CRM 4 organization into 2011 (for workflows with Custom Activities), I need to kill of all existing workflow instances - backup the database - import the organization into 2011 - fix all the workflow definitions and then manually handle the fallout from the deleted workflow instances.

    Is there a better solution than this?

    Thanks

    Paul

    

    

    Monday, August 11, 2014 4:49 PM