How to handle wrong/invalid inputs?

I am trying automating Tally ERP application with UiPath community edition.

Issue: I am unable to handle wrong inputs passed from command prompt.
My Scenario is to Create an invoice for customer “XYZ” with “2 quantities of Product Y” at Rs.5000 per unit.
I have recorded the scenario to this. Here I have created three arguments to pass Customer name, Product name and Quantity through command prompt. So that I can just change them and run through command prompt.

In Tally ERP application it takes the name of customer from the existing name list, means we need to create customer name first. Simple way of selecting customer name is type name and press enter.

But if I by mistake pass the wrong name then how do I handle?
Is there any way to stop the execution at that point and give us an error message?

1 Like

Input validation is a very important part of any automation. You are describing what UiPath often refers to in their documentation as a Business Rule Exception (BRE), meaning that the business has set criteria for their process & if that criteria fails, then the process should fail. How you handle these exceptions is on a case by case basis, because it depends entirely on the business process.

For your example, is there a spreadsheet, database, or other document where there is a list of valid names? If so, you could have the robot check the input against that and mark the transaction as a BRE if matches aren’t found. In your case, it would get the customer name from the command prompt, then look it up in Tally ERP application. If it can’t find the customer, then it will create one (or mark it as an exception to handled manually if you so choose).

Another example is that no name should have a number in it. So you could run a check using regex to look for digits in the string and mark the transaction as a BRE if it finds a match.

1 Like

Hi Dave, I am newbie and I can understand your explanation but I am not sure how do I practically implement it.
Please find the below screenshot on how i am selecting names from my list of names.

I need to type a valid name under the list(List of Ledger Accounts), If I by mistake pass wrong name as below
/input:"{‘partyName’:‘Party Z’}" from command prompt. In this case Party Z is an invalid input which is not listed in the list of names.
Can you please help me with an example here? what all activities you use?
Thanks in advance.


Uipath Academy fulfills it.

You have the hint :slight_smile: ! You need to get all the names (list of ledger names) and store it in a collection (List/Array) say listNameValues. Check the list listNameValues before you key the inputName in the application.

Also search forum for more details like how to check the list and so on… Because others showcase their own opinion and there is a high chance that you get a better solution. :slight_smile:

Dom :slight_smile:

1 Like

Thanks @Dave and @Dominic, I was able to solve my issue using simple If activity.
In Tally ERP tools the error message pops-up when we enter wrong names, But it wont stop moving to next step. So what I did is I used Get visible text activity to get the error message and in the If activity matched the error message, If error exists then close the application else go to next steps.

Something like this below,
Close application;
Continue with next steps

Anyways thanks for the help guys.

1 Like