servicenow-powershell icon indicating copy to clipboard operation
servicenow-powershell copied to clipboard

Number of records different when using the filter vs where.

Open mark3grahams opened this issue 1 year ago • 1 comments

Hi,

I am a bit new to this module, and I am wondering why I am getting different results.

Get-ServiceNowRecord -Table 'change request' -Filter @('opened_at', '-between', (Get-Date).AddMonths(-2), (Get-Date)), '-and', @('type', '-eq', 'Normal') -IncludeTotalCount WARNING: Getting 5 records...

number short_description state assigned_to approval cmdb_ci opened_at


CHG0070484 Add/Remove users from ... New John Smith Not Yet... 11-20-2023 02:19:1... CHG0070489 New John Smith Not Yet... 11-20-2023 02:51:3... CHG0070490 New John Smith Not Yet... 11-20-2023 02:55:4... CHG0070495 New John Smith Not Yet... 11-20-2023 03:28:1... CHG0070496 New John Smith Not Yet... 11-20-2023 03:28:3...

Get-ServiceNowRecord -Table 'change request' -Filter @('opened_at', '-between', (Get-Date).AddMonths(-2), (Get-Date)) -IncludeTotalCount | Where-Object { $_.type -eq 'Normal' } WARNING: Getting 36 records...

number short_description state assigned_to approval cmdb_ci opened_at


CHG0070484 Add/Remove users from ... New John Smith Not Yet... 11-20-2023 02:19:1... CHG0070489 New John Smith Not Yet... 11-20-2023 02:51:3... CHG0070490 New John Smith Not Yet... 11-20-2023 02:55:4... CHG0070491 Test New John Smith Requested 11-20-2023 03:23:5... CHG0070495 New John Smith Not Yet... 11-20-2023 03:28:1... CHG0070496 New John Smith Not Yet... 11-20-2023 03:28:3... CHG0070515 test New John Doe Approved 12-19-2023 12:01:5... CHG0070516 test New Jane Doe Requested 12-19-2023 01:54:5... CHG0070517 test New Jane Doe Requested 12-19-2023 02:00:0... CHG0070518 test New John Doe Approved 12-19-2023 02:02:0...

mark3grahams avatar Dec 22 '23 18:12 mark3grahams

Have you confirmed type looks as expected?

Get-ServiceNowRecord -Table 'change request' -Filter @('opened_at', '-between', (Get-Date).AddMonths(-2), (Get-Date)) -IncludeTotalCount | Select -Property type

gdbarron avatar Mar 10 '24 13:03 gdbarron