Rock icon indicating copy to clipboard operation
Rock copied to clipboard

Entity property Set in Workflows bugged

Open markewampler opened this issue 7 years ago • 1 comments

Prerequisites

Description

using the Entity Set Property in a workflow results in an error on the workflow.

Steps to Reproduce

(using binary file as an example)

  1. Create a workflow
  2. get a binary file guid and id
  3. Create an action that sets the property value
  4. Use your Id and Guid to set the property of Guid to the Guid of a binary file with the Id supplied
  5. Error of Could not convert property value ('d20324d2-28c3-482b-807e-3901d00f7ae7')! Invalid cast from 'System.String' to 'System.Guid'.

Expected behavior:

Update the binary file with the new Guid

Actual behavior: Could not convert property value ('d20324d2-28c3-482b-807e-3901d00f7ae7')! Invalid cast from 'System.String' to 'System.Guid'.

Versions

  • Rock Version: [7.4]
  • Client Culture Setting: [en-us]

markewampler avatar Aug 13 '18 18:08 markewampler

The Entity Set Property action uses Convert.ChangeType() to do the conversion. Apparently, this method does not know how to convert a string to a Guid. For example, the below call fails:

Convert.ChangeType( "eab07a14-bd5f-412d-bbb1-40afb896beea", typeof( Guid ) );

The helper ConvertObject() method probably needs to be updated to do a special check for target == Guid and if so, use .AsGuidOrNull() to do the conversion.

cabal95 avatar Aug 13 '18 18:08 cabal95