What are the UiPath Coding Standards – Best Practise to follow
To create any workflow/piece of automation we need to have it very clear so another developer can grab it quickly. Well, there are such coding standards we need to follow to create a healthy / good workflow. The reason behind this is suppose the developer who was working on project left the company in middle and if other developer join in it will be hard to understand the code if it’s not clear. To avoid such issues we can follow the coding standards as mentioned.
Give Proper name to activity:
For example, if we are using “Assign” Activity we need to mention for what purpose we are using that. So another developer might get it quickly.
Give Proper name to output variable:
For example, if we are using “Get Text” Activity to grab the text from UIElement we can provide the exact name to a variable so a new developer might get it quickly.
When we are automating any process we must have to use multiple activities at this if we have all the activities in one workflow it will be hard to manage and also hard to work on it for two or more developers hence if we separated the workflows in different.XAML files it will be easy to manage and work as well. We can also have a folder structure and place the appreciate .xaml files inside as shown below.
As you can see from the above image we have 3 folders mention the exact names for what purpose it has created. If you also look into the .xaml file names its shows the exact operation of the files. Hence even if a new developer comes into the picture in the middle of the project or for the support application, the developer will get a clear idea and start working/supporting hassle-free.
Use of Annotations:
Annotation is basically used to display a short message to the developer / business for why particular sequence/workflow is created for. To create annotations we can right-click on the activity or sequence and click on Add annotations to write the specific message. Hence if we have multiple activities inside the sequence/workflow we can get exactly what we are looking for.
Use of Log Message:
When we are automating any workflow use of log message is a key point. By this way we can get the exact status of the workflow. So if the workflow is having any runtime error it can be caught it log file which we can refer for debugging to solve the issue.
Use of Take Screenshot Activity:
When we are triggering the process to orchestration we hardly have control over the activities. In such cases, if workflow has any errors at runtime it will be hard to catch the exact error. If we use Take Screenshot activity in catch block it will take the screenshot at that time and place on a mentioned path. By this way, we can get it exact error and can be solved easily without looking for all the code.
We hope this article will help you with perfect workflow creation. Please feel free to comment below if you need any additional information.