How to set an application-wide setting to be utilized in Custom Steps

Learn to set an application wide setting

Last published at: April 19th, 2024

Use-case scenario

My team and I will rely heavily on utilizing FlowWright Custom Steps to send API calls out to our REST APIs. Given all of our Custom Steps will be utilizing the same base URL in a given environment, I wanted to know if there was a way to declare both a global variable and its value for an entire instance of FlowWright. In a pure C# application under our control, we would put something like that within an appsettings.json file and retrieve the configuration value by key within whichever C# class we needed it. Is something similar offered?

 

Solution

The best way to do this is to store it in our configuration table and use the API to get the value.  Use our UI to set the value.  Here’s how to do it, navigate to Status - Settings - Settings Designer.

 

Create a new Item.

 

After the item is created, you can view/modify the value using the following UI:

 

From any of your custom steps, you can now access this value using our API:

string sURL = FWConfigurationSettings.GetValue(ConnectionString, "BaseServiceURL", "", 60);