locked
Custom workflow activity - Testing InArgument<T> for null values RRS feed

  • Question

  • Not sure if I'm over thinking or not thinking at all.
    The scenario is:

    I have a "Not Required" input parameter that accepts an "int".
    I tried to make it an InArgument<int?> but it won't register, CRM says it is an unsupported type.

    Anyways, the user interface will accpet numeric values and also, an empty field.
    The problem is that when the user leave it empty, the the "Get" method will return "0" (because it is not nullable I guess).
    In many cases it is enough but for this particular project I need to know the user didn't enter any data.

    Looks like InArgument<string> is a good option but then I end up with an UI that says "string" and accepts string when the value should be empty or integer.

    Any ideas:

    [Input("Some value")]
    public InArgument<int> SomeValue { get; set; }
    
    protected override void Execute(CodeActivityContext executionContext)
    {
    
        if (SomeValue.Get(executionContext != null) {
            //always true since I get 0 even when the field is empty
        }
    
    }

    Thanks

    Wednesday, August 27, 2014 1:36 PM