Cannot connect to ServiceNow Prod environment

Hello, I am having issues connecting to SNOW production environment using the ServiceNow Connector created by @Cristian_Negulescu. I created a query to get task data. I entered the consumer key, consumer secret, username and password set up for prod in the properties panel, but when I try to run the command I get this:

System.FormatException: The format of value ‘’ is invalid.
at System.Net.Http.Headers.HttpHeaderParser.ParseValue(String value, Object storeValue, Int32& index)
at System.Net.Http.Headers.HttpHeaders.ParseAndAddValue(String name, HeaderStoreItemInfo info, String value)
at System.Net.Http.Headers.HttpHeaders.Add(String name, String value)
at UiPathTeam.ServiceNow.CmdRestAPI.d__61.MoveNext()

However when I changed the environment to Design and test with the same URL and click the Test connection button the query works. Why does it work after I press the test connection button, but not before?

Hello Daniela,

All the Authentication Production values are use only when the environment is Set to Production and all the wizards are disable/ not working. This values will be use exclusive for the Robot on the runtime.

If you want to test something from the Studio in production witch is not recommended you need to put your production details on the Authentication Design. To be sure that your server is Ready please check this videos for all the configuration that you need to do on ServiceNow:

If you want to move from Design to production please follow this video for details:

Thanks,

Cristian Negulescu

Is it required to have all those roles for the servicenow account to work properly in production? I didn’t have those roles for the SN account during design and test and it worked fine.

Hello Daniela,
I think you need to do this Steps to understand exactly what is your problem:
1. put all the connection value for Your production Server on the Authentication Design and set the Environment for Design and test. Go and Studio on Get wizard Design or Get Wizard SQL and run your command.
2. If Step 1 work OK please run the robot with all the configuration value remain the same and see if you have the same result in datatable.
3. Move all the configuration to Authentication Production and change again the Environment to Production and run the robot and see what you get on datatable result.
If you get error only on the Step 3 please give me the SQL command to understand what you interrogate and test on my instance.
Thanks,
Cristian Negulescu

Hi Cristian,

The connection worked after adding the consumer key and consumer secret! I have another issue now pulling in user data from the sys_user table. If the user is inactive it will return no data, but if the user is active it will return the data. Any idea why it cannot pull that information if they are inactive. When I manually signed in with the account I am able to see the user’s data if they are inactive so it is not because they don’t have access to view inactive users.

Hello Daniela,
When you say Dev and Production you mean that you have 2 different instance of ServiceNow? If this is true maybe you have other difference on configuration between the 2 platforms.
For me as a developer the difference between Test and Development and Production Authentication is that in case of Prod Authentication I convert internally all data from SecureString to String, the rest of commands are the same. So only think that I can image is that you have difference between your 2 system Dev and Production.
Please run the Step 2 from the last answer on your production system and see if is working.

Thanks,
Cristian Negulescu

Yes that is correct. We have two instances of ServiceNow. The configurations are set up the same way for the SN account so its not that the account doesn’t have authorities to view inactive users.

I have tried #2 and the same issue happens. I have a test user that is marked as inactive and it returns no data, but as soon as I change that test account to active and run the automation again it is able to find and retrieve the data.

Is the API call that is being made for the custom queries strictly looking for active users?

Hello Daniela,
Sorry for the delay in answering I was on vacation. So the answer is Yes if you use Get User List the default command is getting only the active users please check the picture attached where is say Active true in the SQL.


You can say active false or you can write the query as you want. Also, you can use Get Data Wizard design activity. If you want to test the real ServiceNow command for the default Get User List this one is the full link:
https://dev88464.service-now.com/api/now/table/sys_user?sysparm_action=getRecords&sysparm_exclude_reference_link=true&sysparm_fields=name,user_name,first_name,last_name,email,sys_id&sysparm_limit=100&sysparm_query=active=true^active=true
You can put your instance and do what you want, but yes by default the system will load only the active users.
Thanks,
Cristian Negulescu

Hi Cristian thank you for getting back to me. I tried running a query where active = false and it still does not return any inactive users. I ran the inactive query against our DEV instance. Then had a ServiceNow representative run the same query. It did not return any values for me, but returned values for them. Could it be that the API call only allows calls for active users?

Hello Daniela,
There is strange situation that I will analyze, also in my instance when I run with active false I get NO DATA. Until I will understand exactly what is wrong here is a solution for you. Run SQL like this without WHERE and LIMIT.
SELECT name, user_name, first_name, last_name, email, sys_id, active FROM sys_user


The result will contain an active column and sort on that column and you see values with FALSE like in this picture.

Then on datatable do foreach and select only the values with active false I will promise that if I will understand where is the issue I will fix this on a new release.
Thanks,
Cristian Negulescu

Ok I will try to implement your solution to my automation and let you know how it goes. Thank you!

Hi Cristian,

I removed the WHERE clause from the query:


That query returns 10,000 items. I then print out the data table and row count with this workflow:
workflowsetup
When I run this workflow it returns a count of 0 and an empty data table:

querycount0
For some reason it is not storing the data from the query into the data table. Could it be because data it is trying to store is too large? Is there a limit to how much the data table can store in UiPath?

Hello Daniela,

Tommorow at 11 am Romania hour you will have the new update on uipath Go and this issue will be fixed. Sorry for the delay but I was in vacation and no other clients request inactive items.

Thanks,

Cristian Negulescu

Hello Daniela,
The update is on the market place:


The version 271 the limitation with only active data is removed, so now in your SQL if you will put active false this will work and return your user in your case.
Thanks,
Cristian Negulescu

@Daniela_Ulloa , I too am experiencing the same System.FormatException issue that you have encountered

After trying many different configuration changes, I discovered (accidentally) that it was resolved by first executing the “Test Connection” button in the Application Scope

@Cristian_Negulescu, can you please confirm if this is an undocumented feature, or a coincidence

Hello Phil,
I try on my System to run the Robot in Production and the Get Data Wizard SQL is returning Data without any Issue.
If you are in Production all the WIZARD from UiPath Studio won’t work. If you are in Design AND Testing all the wizards will work, but before trying to do something you need to click the Test Connection button and this connection will be valid 1 hour.
Here I have some movies on how to change from Design to Production:


and

If you still have this issue try to update to the latest version and tell me step by step what are you doing.
Thanks,
Cristian Negulescu

Cristian

thanks for the reply

It was the “click the Test Connection” step that I was missing

All good now