Force number of characters in argument

Is there a way to force the number of characters that an argument of a custom activity will accept?

When we try to send an argument value that’s the wrong type to an activity, we’re informed of it right away (for example, a string when the argument is set up as an integer) - Studio won’t even let us make that mistake. Is there a way to force number of characters too?

Sure, I can create error catching within the activity that will throw an error if a wrong number of characters is sent but I was wondering if there’s a way to prevent that before it even gets there.

so, we assume it is talked about coding in Visual Studio

We would recommend to check the option if Validations can be defined by using Annotations

like:

[Required]
[StringLength(4, ErrorMessage = "PCode value cannot exceed 4 characters. ")] 
public string PCode { get; set; }

But still we should keep in mind that validation also requires action. Also not every value is hardcoded and therefore the validation can in such a case only work on runtime and check

I meant custom activities saved within a custom library.
When referencing those activities outside of the library, we can see what arguments are required. I can set up a tooltip as help, but that’s about it.

For example, there’s one argument that no matter what, it has to be a four characters long. I was wondering if I could warn the user that they entered an invalid argument into that activity before they even run the process - to stop the compiler and give them a system-generated red exclamation mark as soon as they enter it - much in the same way that Studio warns us if we input a string where it wants an integer.

we adressed with:

with the info:

No, such validations are not available

we also refer to docu:

That’s a good point.

I was just wondering if it was an existing feature that would save time - force you to debug before you even run it.

For example, this variable is Int32. I try to send a string to it and immediately get notified that I’m doing an oopsie.


It would be cool if we could set up the same type of immediate validation for number of characters (or for even more interesting parsing - imagine the possibilities).

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.