Sticky

This blog has moved to www.dreamingincrm.com. Please update your feed Url. Thank you.

21 February 2015

Bug: Limitation of Action EntityReference Input Argument

Actions are great for lot of things, but there are few bugs/limitations that I experienced and found particularly frustrating. One of such bugs is that you cannot use the attributes of an entityreference input argument on an action step. This is not the same with custom workflow step with an entityreference output. You would be able to use any attribute from the entityreference output off the custom workflow step.

Here is the action definition

The entityreference action argument is available in the dropdown and all the properties appear as if they can be used.




Here is the create email step with values from workflow and action argument being used.



I also have a custom workflow step that accepts an entityreference input and just sets the entityreference output.

The custom workflow step input is set the action input argument.


This code for the custom workflow step is quite simple.

using System.Activities;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Query;
using Microsoft.Xrm.Sdk.Workflow;

namespace TestWorkflows
{
    public sealed class ActionParameterToContactEntityReference : CodeActivity
    {
        [Input("Contact")]
        [ReferenceTarget("contact")]
        [RequiredArgument]
        public InArgument<EntityReference> ContactInput { get; set; }

        [Output("Contact")]
        [ReferenceTarget("contact")]
        public OutArgument<EntityReference> ContactOutput { get; set; }

        protected override void Execute(CodeActivityContext executionContext)
        {
            ContactOutput.Set(executionContext, ContactInput.Get(executionContext));
        }
    }
}


This is the email activity after the action is created.



As you can see, the Email and Firstname properties from the action's input entity reference comeup as blank, but there is no such issue with the ones retrieved from the custom workflow step.

No comments:

Post a Comment