Rock
Rock copied to clipboard
Entity property Set in Workflows bugged
Prerequisites
- [ x] Put an X between the brackets on this line if you have done all of the following:
- Can you reproduce the problem on a fresh install or the [http://rock.rocksolidchurchdemo.com/ demo site ]()?
- Did you include your Rock version number and [https://github.com/SparkDevNetwork/Rock/wiki/Environment-and-Diagnostics-Information client culture ]() setting?
- Did you [https://github.com/issues?q=is%3Aissue+user%3ASparkDevNetwork+-repo%3ASparkDevNetwork%2FSlack perform a cursory search ]() to see if your bug or enhancement is already reported?
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)
- Create a workflow
- get a binary file guid and id
- Create an action that sets the property value
- Use your Id and Guid to set the property of Guid to the Guid of a binary file with the Id supplied
- 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]
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.