question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

sysparams not passed when making call to a table.

See original GitHub issue

I have a function def connect_to_instance(self, instance_name, username, password): c = pysnow.Client(instance=instance_name, user=username, password=password) c.parameters.add_custom({'sysparm_display_value': 'True', 'sysparm_exclude_reference_link': 'True'}) return c

My querybuilder query: (pysnow.QueryBuilder().field('assignment_group').equals(['https://my_instance.service-now.com/api/now/table/sys_user_group/my_group_value', 'my_group_value']).AND().field('state').not_equals('100'))

I get results back from service now, foreign key relationships are followed and I get the values I expect.

But when I try to query with the foreign key values and not the values from the actual change table: (pysnow.QueryBuilder().field('assignment_group').equals('MY-SWEET-GROUP').AND().field('state').equals('Closed')) I get no results back.

Is there another place I need to set the client parameters?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
rbwcommented, Feb 13, 2018

Sure, no problem 😃

Ah, all right. Yeah, those can be a little tricky… and choices usually contain translations, so I’d recommend you to use ID instead (field(‘state’).equals(‘7’) for instance). This should be OK as choice IDs normally don’t change, the labels however - you never knopw about those.

With that said… if you do want to get the state ID by name, you could do something like this:

def get_incident_state_id(label):
    choices = c.resource(api_path='/table/sys_choice')
    states = choices.get(query={'label': label, 'name': 'incident'})
    state = states.first()
    return state['value']

state_id = get_incident_state_id('Closed')
0reactions
jwshivecommented, Feb 13, 2018

Ah that helped out a bit.

pysnow.QueryBuilder().field('assignment_group.name').equals('MY-SWEET-GROUP').AND().field('state.name').not_equals('Closed'))

This limits my result set to MY-SWEET-GROUP but I’m getting incidents of all status.

Thanks much for the clarifications.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Table API GET Call not returning all values - ServiceNow
Solved: My PowerBI specialist is running a Table API with the following parameters.
Read more >
Passing Parameters to System Calls - IBM
Parameters are passed to system calls in the same way that parameters are passed to other functions, but some additional calling conventions and...
Read more >
Systemcalls that does not exist in systemcall table
I finally got the hold of the complete list of system calls from STrace source code!
Read more >
Issues with outbound calls - Microsoft Teams
In this article. Incorrect caller ID displayed to the recipient; Connection to the SBC not established; Some users are unable to make calls...
Read more >
Using Your Desk Phone - Cornell College
Make a Call Using Your Desk Phone; Transfer a Call to Another Extension ... Connect to the Voicemail of an Extension; Call Parking;...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found