How do i add multiple error to business rule exception

I have a scenario where i have to validate character length of 2 string.
String A>12
String b>13
Validate Both the string and throw business exception with all the error messages how can i do that in uipath

Use a IF CONDITION like this
StringA.Length> 12 AND stringB.Length>12
If true it will go to Then part part where we can use any other activities we want or goes to ELSE part where we can use THROW activity with input as
New BusinessException(“length is more than the value”)

So that it will throw exception

Concatenate both error messages.

Declare one string variable with a default value empty

strErrMessage = ""

if stringA > 12
 strErrMessage = "string A length failed"

if stringB > 13
strErrMessage = strErrMessage + " " + "string B length failed"

if strErrMessage.Trim.Length > 0 Then
      Throw Activity, New BusinessException(strErrMessage)

Karthik Byggari


Thank you Karthik. This should solve it.

If that helped you please mark my post as solution.

Karthik Byggari

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