Working with ServiceNow is all about filling in forms and moving data across various states. Automating processes that involve these forms can be a real challenge. Here's how to easily do it with Leapwork.
Automatically filling out forms in ServiceNow with external data - whether it's for testing or process automation purposes - can seem like a technically daunting challenge.
We've made a sample Leapwork automation flow for handling ServiceNow forms, along with a bunch of pre-made, out-of-the-box components, or sub-flows, specifically for ServiceNow automation.
The "SNC Form Handler" component is especially useful for filling form fields with values using an external data source.
With the standard web automation components in the Leapwork Automation Platform, it's easy to capture a field and fill in a value one at a time.
But what if there's a lot of fields to be filled, or if you're looking to maintain the inputted values in a data source, e.g. a spreadsheet, database or similar? In these cases, point-and-click UI automation still works, but using the SNC Form Handler component is much more efficient.
As demonstrated in the video tutorial above, the component accepts three parameters per field in the form:
Let's take a look under the hood of the SNC Form Handler component to understand its inner workings:
The three parameters mentioned are defined to the left and a Switch component handles the different Field Types. Depending on the Field Type, one of three embedded sub-flows are then triggered. For example, if the Field Type is "Text", then the "SNC Set Text Field by Label" sub-flow is triggered, passing two of the parameters, Field Label and Field Value, to the sub-flow.
Going one step deeper, the component "SNC Set Text Field by Label" looks like this on the inside:
In this component, three things happen:
As mentioned above, setting a field requires three parameters: Type, Label, and Value.
Automatically filling a form with several fields is easily done by using the SNC Form Handler component in combination with an external data source, e.g. a spreadsheet, a database, a web service, etc. This way, the component provides the three parameters for each field in the form, and the data source provides the values to be inputted in the fields. When the automation flow is executed, Leapwork can iterate through all rows of data in the data source, if needed.
In the example below, the Leapwork component "Read Excel" is used for data-driven automation of a ServiceNow form.
First, we want to specify which data in the spreadsheet, we want to use. This is done with the "Select Range" functionality.
Notice, that this data set contains three columns: Field Type, Field Label, and Field Value- each with seven rows of data.
The column headers are used as input parameters for the SNC Form Handler component. With Leapwork, driving data this is simply done by visually connecting data sources to the component using the data as input. The connectors are the blue arrows in the screenshot below.
This is all there is to design a data-driven automation flow involving an Excel-file and a ServiceNow form. Note that the method 'Iterate' is selected, which means that Leapwork will go through all rows of the selected data range, process them one at a time, and execute the SNC Form Handler component for each row of data.
Once all data rows have been processed and values have been applied in the ServiceNow form, the automation flow moves on to whatever action is next to be executed.
Check out Leapwork's tutorials, out-of-the-box samples, and educational resources to get started with ServiceNow automation.
Or kick-off your ServiceNow automation with our whitepaper: