Need a InArgument from within specific values


#1

We have been creating numerous xaml files and accepting InArguments.
But there have been many cases where we expect that the InArgument value should be one of the set of values.
This facility is not yet available.

Eg.
Project has foll. files:
Main.xaml
ReusableComponent.xaml [InArgument - String - Default Value{“ABC”}]

The ReusableComponent performs -

Action1 if InArgument = "ABC"
Action1 if InArgument = “XYZ”

Here, since the Caller can send-

InArgument=“DEF”

we have to implement-

Else
Throw Exception

If there was a feature where I could restrict the possible values that the caller send. Then this will save me implementing many error conditions which will never appear.
I could possibly use one of the values in an Enum type InAgrument.

Kindly let me know if this is possible.
Currently I see no way to achieve this capability.


#2

In your workflow, you can put If condition and through your custom exception.

You can create your custom exception using “Create Exception” activity and You can Through Exception using “Through Exception” activity.

Note, You need to install/enable Microsoft Activities Package for above activities.

Regards,
Kuldip


#3

Thanks for the suggestion.
That’s exactly what I’ve done right now. :slight_smile:

That’s where I got this idea where we need not implement and handle these custom exceptions.
There wouldn’t be any need to if we have a dropdown of sorts when passing the values to a workflow being invoked.


#4

One could also use Throw activity, without the need to install additional packages (although that one has some really useful ones, so it’s good to have it anyway).

@akhi_s27 [quote=“akhi_s27, post:3, topic:1218”]
There wouldn’t be any need to if we have a dropdown of sorts when passing the values to a workflow being invoked.
[/quote]

You could import a package with a custom enum, although that still won’t give a dropdown as far as I can tell.
Having a Switch for different input value, with the Default throwing ArgumentException would be the easiest/most straightforward way though. If a workflow receives an argument that it cannot handle it means there was a flaw during design and that warrants an exception be thrown. Especially since you cannot envision all scenarios that a reusable component might be invoked in.

Regards.