Workflows with advanced destinations sets error in an E-mail event when it is configured to send email to the destination users. This only affects workflows created in K2 Studio or K2 for Visual Studio that use advanced destinations, you have updated the design templates, and redeployed on K2 blackpearl 4.7. Existing running workflows will continue to function as normal after upgrade.

Image

Image 1: Destination Rule configured in advanced mode.

Image

Image 2: Destination User checkbox selected in E-mail event.

Error Message
Unable to cast transparent proxy to type ‘SourceCode.KO.User’.

Workaround
To resolve the issue perform the following steps:

  1. Download the latest Cumulative Update.
  2. Apply the cumulative update to your K2 environment.
  3. Right click on the design canvas and select Update Design Templates…
    Image
     
    Image 3: Update Design Templates… option in K2 Studio.
  4. Deploy new workflows and affected existing workflows.

Running instances workaround

For workflow instances that are already in error state use one of the following options:

Option 1 – Use Goto Activity
You can move the instance on in the workflow by using the Goto Activity option in the K2 Management Site.

Option 2 – Use SetProcessInstanceVersion.exe
With the coldfix from K2 Support you will also get the file SetProcessInstanceVersion.exe or download the tool from K2 community. Use this tool to set the workflow version that the workflow in error must use. There are two scenarios in which the tool can be used.

This scenario applies if the workflow version has not been modified.

  1. Open K2 Management Site and browse to the Workflow Server > Workflows > [Your Workflow].
  2. Take note of the ID of the instances with an Error status.

    Image

  3. Run the SetProcessInstanceVersion.exe  on any K2 client machine, and in the Process Instance ID field type the ID. In the Process Version field type the latest available version of the workflow (Enter the latest version of the workflow).

    Image

    To check the version number you can browse to K2 Management site, and navigate to Workflow Server > Workflows > [Your Workflow], and click the Versions tab. The workflow marked (Default) is usually the latest deployed version.

    Image

  4. Click Set.
  5. On the succeed message click OK.
  6. In K2 Management site, browse back to Workflow Server > Workflows > [Your Workflow], select the workflow in error and click Retry.  

    Image

  7. Refresh the list and the workflow is no longer listed and has been repaired.

The workflow has been modified and there is a newer version available.

  1. Open K2 Management Site and browse to the Workflow Server > Workflows > [Your Workflow].
  2. Take note of the ID and Version of the instances with an Error status.

    Image

  3. Select the Versions tab and select the corresponding workflow version in the list.
  4. Click the Download icon in the navigation bar.

    Image

  5. Save the workflow definition to a local directory.
  6. Open the saved workflow in K2 Studio or K2 for Visual Studio.
  7. Right-click on the canvas and select Update Design Templates…

    Image

  8. Redeploy the workflow. This creates a new version of the workflow.
    Important: No new workflow instances should be started after redeploying the workflow. Once the original workflow is set as the default again (step 10), new workflow instances can be started.
  9. In K2 Management site browse back to Workflow Server > Workflows > [Your Workflow], select the Versions tab. Take note of the latest version number (this is the version you just deployed).

    Image

  10. Select the version number below the latest version  and click the Set as Default icon (this will ensure that any new instances that are started will use the correct version of the workflow).
    Image
  11. Run the SetProcessInstanceVersion.exe tool, and in the Process Instance ID field, type the ID of the errored workflow. In the Process version field, type the version number noted in step 10. 

    Image

  12. Click Set.
  13. On the succeed message click OK.
  14. In K2 Management site browse back to Workflow Server > Workflows > [Your Workflow], and select the workflow in error and click Retry.  

    Image

  15. Refresh the list and the workflow does not appear and has been repaired.