---
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


---

# Findings - Scoped, Global

# Findings - Scoped, Global {#ariaid-title1}

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

The Findings API provides methods for handling how an Instance Scan check produces findings.

This API is included with the Instance Scan (com.glide.instance_scan) plugin and runs in the `sn_instance_scan` namespace. For more information, see [Instance Scan](https://www.servicenow.com/docs/access?context=hs-landing-page&version=xanadu&pubname=xanadu-platform-administration&ft:locale=en-US).

In Instance Scan, checks run on each record in the scope of a scan on the instance to generate findings. Each finding holds information about an issue record and which check it violated. Findings methods are used
in Instance Scan checks as part of the engine object passed to the user. Add the code to the Script field in the check form.  
See also:

* [Getting started with
  checks](https://www.servicenow.com/docs/access?context=hs-intro-health-check&version=xanadu&pubname=xanadu-platform-administration&ft:locale=en-US)
* [Findings](https://www.servicenow.com/docs/access?context=hs-findings&version=xanadu&pubname=xanadu-platform-administration&ft:locale=en-US)
{#FindingsAPI__ul_hlw_q5y_spb}

## Findings - increment() {#ariaid-title2}

Increases the count of the current finding.
The finding count starts at zero for each record that a check analyzes in a scan. When
called, this method increments the finding count. The count indicates that a finding is to
be generated for the current record.

This method can be called multiple times to signify that this finding has multiple
occurrences of a check violation in the current record.
{#Findings-increment__table_ckd_hxt_4pb__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 1. Parameters]

{#Findings-increment__table_ckd_hxt_4pb} {#Findings-increment__table_dkd_hxt_4pb__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 2. Returns]

{#Findings-increment__table_dkd_hxt_4pb}  
The following example shows how to count the number of records with a failed state in a
table type check. For more information, see [Create a table type check](https://www.servicenow.com/docs/access?context=hs-create-table-health-check&version=xanadu&pubname=xanadu-platform-administration&ft:locale=en-US).

    (function(engine) {
      if (current.getValue("state") == "failed") {
        engine.finding.increment();
      }
    })(engine);

## Findings - incrementWithNode(Object node) {#ariaid-title3}

If the current finding is from a linter check, this method increments the current
finding count and simultaneously passes the linter node object to the finding.
Use this method in the Script field in the [Linter Check form](https://www.servicenow.com/docs/access?context=hc-linter-check&version=xanadu&pubname=xanadu-platform-administration&ft:locale=en-US). This method
saves information about the given node, such as a line number in a current finding's details
column.  
See also:

* [Advanced linter check
  scripts](https://www.servicenow.com/docs/access?context=hs-linter-check-scripts&version=xanadu&pubname=xanadu-platform-administration&ft:locale=en-US)
* [LinterCheckAstNode API](https://servicenow-prod.fluidtopics.net/jA4X_P4RVBHasVMg0ERxXQ#LinterCheckAstNodeAPIBoth "The LinterCheckAstNode API provides methods for getting abstract syntax tree (AST) node details in linter checks.")
{#Findings-incrementWithNode_O__ul_nxz_f5y_spb}
{#Findings-incrementWithNode_O__table_ckd_hxt_4pb__entry__3}

| Name | Type | Description |
|-|-|-|
| node | Object | Node object from the linter check. |
[Table 3. Parameters]

{#Findings-incrementWithNode_O__table_ckd_hxt_4pb} {#Findings-incrementWithNode_O__table_dkd_hxt_4pb__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 4. Returns]

{#Findings-incrementWithNode_O__table_dkd_hxt_4pb}  
The following example shows how to increment linter type nodes in a linter check. For
information on using linter check methods, see [LinterCheckAstNode
API](https://servicenow-prod.fluidtopics.net/jA4X_P4RVBHasVMg0ERxXQ#LinterCheckAstNodeAPIBoth "The LinterCheckAstNode API provides methods for getting abstract syntax tree (AST) node details in linter checks.").

    (function(engine) {
      engine.rootNode.visit(function(node) {
        if (node.getTypeName() === "NAME" &&
            node.getNameIdentifier() === "soughtFunction" &&
            node.getParent().getTypeName() === "CALL") {
          engine.finding.incrementWithNode(node);
        } 
      });
    })(engine);

## Findings - setCurrentSource(GlideRecord source) {#ariaid-title4}

Sets the source of the current finding based on the provided GlideRecord.
Use this method in the Script field of a Script Only check. This
method is not used for any other checks because they automatically set the source as the
current record during the scan. For more information, see [Create a script only check](https://www.servicenow.com/docs/access?context=hs-create-script-health-check&version=xanadu&pubname=xanadu-platform-administration&ft:locale=en-US).
{#Findings-setCurrentSource_O__table_ckd_hxt_4pb__entry__3}

| Name | Type | Description |
|-|-|-|
| source | GlideRecord | The record to set as the source record for the current finding. This value is added as a reference in the Source field of the Scan Findings \[scan_finding\] table. |
[Table 5. Parameters]

{#Findings-setCurrentSource_O__table_ckd_hxt_4pb} {#Findings-setCurrentSource_O__table_dkd_hxt_4pb__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 6. Returns]

{#Findings-setCurrentSource_O__table_dkd_hxt_4pb}  
The following example shows how to set the current source to an incident record in a script
only check. For more information, see [Create a script only check](https://www.servicenow.com/docs/access?context=hs-create-script-health-check&version=xanadu&pubname=xanadu-platform-administration&ft:locale=en-US).

    (function(engine) {
      var gr = new GlideRecord('incident');
      gr.get('2f99f330730210100a5310c92bf6a798');
      engine.finding.setCurrentSource(gr);
      engine.finding.increment();
    })(engine);


