---
sourceDocument: Xanadu API Reference
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# PASnapshot - Scoped

# PASnapshot - Scoped {#ariaid-title1}

* Release version: Xanadu
* 
* Updated August 1, 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 2 minutes to read

The PASnapshot API enables you to query information about Performance Analytics snapshots. Snapshots are the lists of records (sys_ids) that are collected at the time that the scores for those records are collected. A snapshot is made only for automated indicators with Collect records selected.

You can query information about a snapshot at a certain date using the indicator sys_id and
date, and perform comparisons between snapshots for an indicator at different dates.

## PASnapshot - getCompareIDs(String sys_id, Number date1, Number date2, String type) {#ariaid-title2}

Compares records in snapshots for a specified indicator at multiple dates, such as to identify records included in one snapshot but not the other.
{#PASn-getCompareIDs_S_n_n_S__table_jrk_qcq_nw__entry__3}

| Name | Type | Description |
|-|-|-|
| sys_id | String | Indicator's sys_id. |
| date1 | Number | Date of the first snapshot. Format: yyyymmdd |
| date2 | Number | Date of the second snapshot. Format: yyyymmdd |
| type | String | Data to retrieve. Valid values: * all1: all records in the first snapshot * all2: all records in the second snapshot * shared: records that are in both snapshots * movedin: records that are in the first snapshot, but not the second * movedout: records that are in the second snapshot, but not the first {#PASn-getCompareIDs_S_n_n_S__ul_pdr_xnr_nw} |
[Table 1. Parameters]

{#PASn-getCompareIDs_S_n_n_S__table_jrk_qcq_nw} {#PASn-getCompareIDs_S_n_n_S__table_krk_qcq_nw__entry__2}

| Type | Description |
|-|-|
| String | A comma-separated list of sys_id values. |
[Table 2. Returns]

{#PASn-getCompareIDs_S_n_n_S__table_krk_qcq_nw}  

    var snapshot2 = PASnapshot.getCompareIDs('fb007202d7130100b96d45a3ce6103b4', 20160430, 20160531, 'shared');
    gs.info(snapshot2);

Output:

    *** Script: 09c01200d7002100b81145a3ce6103ab,19c01200d7002100b81145a3ce6103e9,fcc01200d7002100b81145a3ce61035b,....

## PASnapshot - getCompareQuery(String sys_id, Number date1, Number date2, String
type) {#ariaid-title3}

Returns the query used to compare records in snapshots for a specified indicator at multiple dates.
{#PASn-getCompareQuery_S_n_n_S__table_tgw_sbq_nw__entry__3}

| Name | Type | Description |
|-|-|-|
| sys_id | String | Indicator's sys_id. |
| date1 | Number | Date of the first snapshot. Format: yyyymmdd |
| date2 | Number | Date of the second snapshot. Format: yyyymmdd |
| type | String | Specifies what data to retrieve. Valid values: * all1: all records in the first snapshot * all2: all records in the second snapshot * shared: records that are in both snapshots * movedin: records that are in the second snapshot, but not the first * movedout: records that are in the first snapshot, but not the second {#PASn-getCompareQuery_S_n_n_S__ul_pdr_xnr_nw} |
[Table 3. Parameters]

{#PASn-getCompareQuery_S_n_n_S__table_tgw_sbq_nw} {#PASn-getCompareQuery_S_n_n_S__table_ugw_sbq_nw__entry__2}

| Type | Description |
|-|-|
| String | The table, view, and encoded query as a JSON string. |
[Table 4. Returns]

{#PASn-getCompareQuery_S_n_n_S__table_ugw_sbq_nw}  

    var snapshot4 = PASnapshot.getCompareQuery('fb007202d7130100b96d45a3ce6103b4', 20160530, 20160531, 'all1');
    gs.info(snapshot4);

Output:

    *** Script: {
      "view":"",
      "query":"sys_idINjavascript:new PAUtils().getCompareSnapshotIDs(\"fb007202d7130100b96d45a3ce6103b4\",
      \"20160530\",
      \"20160531\",
      \"all1\")",
      "table":"incident"
    }

## PASnapshot - getIDs(String sys_id, Number date) {#ariaid-title4}

Returns the sys_id values for all records contained in the snapshot for a specified indicator at the specified date.
{#PASn-getIDs_S_n__table_knc_xbq_nw__entry__3}

| Name | Type | Description |
|-|-|-|
| sys_id | String | Indicator's sys_id. |
| date | Number | Date when the snapshot was taken. Format: yyyymmdd |
[Table 5. Parameters]

{#PASn-getIDs_S_n__table_knc_xbq_nw} {#PASn-getIDs_S_n__table_lnc_xbq_nw__entry__2}

| Type | Description |
|-|-|
| String | A comma-separated list of sys_id values. |
[Table 6. Returns]

{#PASn-getIDs_S_n__table_lnc_xbq_nw}  

    var snapshot1 = PASnapshot.getIDs('fb007202d7130100b96d45a3ce6103b4', 20160530);
    gs.info(snapshot1);

Output:

    *** Script: 09c01200d7002100b81145a3ce6103ab,19c01200d7002100b81145a3ce6103e9,fcc01200d7002100b81145a3ce61035b,....

## PASnapshot - getQuery(String sys_id, Number date) {#ariaid-title5}

Returns the query used to generate the snapshot for a specified indicator at the specified date.
{#PASn-getQuery_S_n__table_pth_pbq_nw__entry__3}

| Name | Type | Description |
|-|-|-|
| sys_id | String | Indicator's sys_id. |
| date | Number | Date the snapshot was taken. Format: yyyymmdd |
[Table 7. Parameters]

{#PASn-getQuery_S_n__table_pth_pbq_nw} {#PASn-getQuery_S_n__table_qth_pbq_nw__entry__2}

| Type | Description |
|-|-|
| String | The table, view, and encoded query as a JSON string. |
[Table 8. Returns]

{#PASn-getQuery_S_n__table_qth_pbq_nw}  

    var snapshot3 = PASnapshot.getQuery('fb007202d7130100b96d45a3ce6103b4', 20160530);
    gs.info(snapshot3);

Output:

    *** Script: {
      "view":"",
      "query":"sys_idINjavascript:new PAUtils().getSnapshotIDs(\"fb007202d7130100b96d45a3ce6103b4\",
      \"20160530\")",
      "table":"incident"
    }


