sysparams not passed when making call to a table.
See original GitHub issueI 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:
- Created 6 years ago
- Comments:5 (3 by maintainers)
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:
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.