I have created a basic workflow that does the following:
Step 1: Calculate "2 business hours" from
Step 2: Timeout until
Step 2.1: Create Task
Step 1 is processed successfully and Step2
fails immediately thereafter (i.e. it does not even wait for "2 business hours" and then process the remaining statements)
The following error is recieved: "Workflow paused due to error: Unhandled Exception: System.InvalidCastException: Specified cast is not valid.
at lambda_method(Closure , ActivityContext )
at Microsoft.VisualBasic.Activities.VisualBasicValue`1.TryGetValue(ActivityContext context, TResult& value)
at System.Activities.InArgument`1.TryPopulateValue(LocationEnvironment targetEnvironment, ActivityInstance activityInstance, ActivityContext resolutionContext)
at System.Activities.ActivityInstance.ResolveArguments(ActivityExecutor executor, IDictionary`2 argumentValueOverrides, Location resultLocation, Int32 startIndex)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
If however I add an Update Lead:MyCustomDate step in between Steps 1 and 2, and then timeout on the updated field, it works fine
Step 1: Calculate 2 business hours from
Step 2: Update Lead:MyCustomDate == (Lead:CreatedOn + 2BusinessHours)
Step 3: Timeout until
Step 3.1: Create Task
I have set my CRM Server and CRM User to both US DateTime formats and SouthAfrican DateTime formats and this makes no difference (Initially I thought it might be related to my SouthAfrican DateTime format)
PS. I also noticed that if I add any "breaks" to my business hours calendar in CRM, these are not calculated into the equation.
Start @ 08h00 End @ 12h00 (Work Hours)
Start @ 12h00 End @ 13h00 (Lunch) ... This is still considered as working hours ...
Start @ 13h00 End @ 17h00 (Work Hours)
I would be most greatful for any assistance in resolving the above mention error.