Table api sys_user is not returning all accounts or retuned wrong total account

Aakansha2
Kilo Contributor

Hello,

As we are calling Table API for fetching user data (sys_user). where in code i am taking total count of the user with X-Total-Count. And we are using this api https://your-instance.service-now.com/api/now/table/sys_user?sysparm_limit=10000&sysparm_offset=0 for pagination.

As one of our customer have 61189 users (this value is returned by X-Total-Count) but when they are calling this api

https://your_instance.service-now.com/api/now/v1/table/sys_user?sysparm_limit=10000&sysparm_offset=6...

it is returning only one user. it should return 15 accounts. Why this api is not returning all accounts or it is returning wrong total user count. Please help me with that.

 

14 REPLIES 14

Hi,

Search for any business rule for sys_user table with Query=true

Regards

Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Akansha,

Any update on this?

Regards

Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hello Ankur,

We have update this to customer but they aren't sure that they have added any business rule.

Hello Ankur,

Can you please tell me how can I create any business rule or any restriction so that sys_user api didn't fetch some accounts.

Thanks 

Hi Aakansha,

you can use query business rule on sys_user table; I consider you must be having a user account for API; For example: I assume you want to allow only those users belonging to the company A

Condition: gs.getUserName() == 'that user name'

Script: sample below

current.addQuery('company.name', 'Company A');

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader