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

 Release :

    - australia

ft:locale :

    - en-US

ft:publication_title :

    - Australia API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# LeadAPIValidationUtilOOB - Scoped

# LeadAPIValidationUtilOOB - Scoped {#ariaid-title1}

Release version: Australia  
Updated March 12, 2026  
![](https://www.servicenow.com/docs/portal-asset/ico-clock) 3 minutes to read  
The LeadAPIValidationUtilOOB script include provides methods that are called by the lead REST API to validate lead records and associated lead line item records when they are created (POST)
or updated (PATCH).

If you want to customize how lead records are validated when the [lead API](https://servicenow-prod.fluidtopics.net/Orqlbh38T0WctIisVNRQ9g#lead-api "The lead API provides endpoints that enable you to create, update, and query/retrieve marketing leads and their associated lead line items from an instance.") methods are called, override the methods in this script include in the LeadAPIValidationUtil script include. The names of the methods that you are overriding in the
LeadAPIValidationUtil script include must be the same as those in the LeadAPIValidationUtilOOB script include file.

This API is provided within the `sn_lead_mgmt_core` namespace. To access the API, the Lead Management Data Model (sn_lead_mgmt_core) plugin must be activated on the instance, and the calling
user must have the sn_lead_mgmt_core.lead_integrator role.

For additional information on Lead Management, see [Using Lead Management](https://www.servicenow.com/docs/access?context=lead-management-using&version=australia&pubname=australia-order-management&ft:locale=en-US).

## LeadAPIValidationUtilOOB - validateLeadObjectForPatchCall (Object leadObject) {#ariaid-title2}

Validates the passed fields for a specified lead and its associated line items when updating a lead record using the `PATCH` endpoint of the lead API.
This method is triggered by the processUpdateLead() method in the LeadAPIValidationUtilOOB script include. This method performs various validations, such as:

* Checks for mandatory fields
* Checks that the phone number and email address have the proper format.
* Checks choice and reference fields, ignoring any invalid values.
* Validates the stage and throws an error if the user attempts to qualify a lead.
{#LAVU-valLeadObjectForPatchCall_O__table_g1v_qls_ydc__entry__3}

| Name | Type | Description |
|-|-|-|
| leadObject | Object | Fields to update in the specified lead record and associated lead line item records. For a list of the fields that can be passed and their associated requirements, see [lead - PATCH /sn_lead_mgmt_core/lead/{sys_id}](https://servicenow-prod.fluidtopics.net/Orqlbh38T0WctIisVNRQ9g#lead-PATCH-lead "Updates the specified lead record and its associated lead line items. You can also use this endpoint to associate new lead line items to the specified lead."). |
[Table 1. Parameters]

{#LAVU-valLeadObjectForPatchCall_O__table_g1v_qls_ydc} {#LAVU-valLeadObjectForPatchCall_O__table_h1v_qls_ydc__entry__2}

| Type | Description |
|-|-|
| \<JSON object\> | Results of the validation. { "errors": [Array], "indexesOfleadLineItemsForInsertion": [Array] } |
| \<JSON object\>.errors | Details of the errors detected while validating the passed lead and lead line item object. Returns an empty array if no errors are detected. For example: [ {"email":"Invalid email address."}, {"last_name":"Mandatory field is either missing or invalid."}, {"lead_line_items[0]/product_offering":"Mandatory field is either missing or invalid."} ] These error messages are located in the LeadAPIConstantsOOB script include. Data type: Array of Objects |
| \<JSON object\>.indexesOfleadLineItemsForInsertion | Indexes of new lead line items that need to be inserted in the leadObject. Data type: Array of Integers |
[Table 2. Returns]

{#LAVU-valLeadObjectForPatchCall_O__table_h1v_qls_ydc}  
The following code example shows where to add your custom code for the validateLeadObjectForPatchCall() method in the LeadAPIValidationUtil script include.

    var LeadAPIValidationUtil = Class.create(); 

    LeadAPIValidationUtil.prototype = Object.extendsObject(LeadAPIValidationUtilOOB, { 

    // Define overriding functions here

    validateLeadObjectForPatchCall: function(leadObject) { 
    // Add your custom code here
    }, 

    type: 'LeadAPIValidationUtil' 

    });

## LeadAPIValidationUtilOOB - validateLeadObjectForPostCall (Object leadObject) {#ariaid-title3}

Validates the passed fields for a specified lead and its associated line items when creating a lead record using the `POST` endpoint of the lead API.
This method is triggered by the processCreateLead() method in the LeadAPIValidationUtilOOB script include. This method performs various validations, such as:

* Checks for required fields.
* Checks that the phone number and email address have the proper format.
* Checks choice and reference fields, ignoring any invalid values.
{#LAVU-valLeadObjectForPostCall_O__table_ggp_t1s_ydc__entry__3}

| Name | Type | Description |
|-|-|-|
| leadObject | Object | Fields to insert in the new lead record and associated lead line item records. For a list of the fields that can be passed and their associated requirements, see [lead - POST /sn_lead_mgmt_core/lead](https://servicenow-prod.fluidtopics.net/Orqlbh38T0WctIisVNRQ9g#lead-POST-lead "Creates a lead record and its associated lead line items using the specified parameters."). |
[Table 3. Parameters]

{#LAVU-valLeadObjectForPostCall_O__table_ggp_t1s_ydc} {#LAVU-valLeadObjectForPostCall_O__table_hgp_t1s_ydc__entry__2}

| Type | Description |
|-|-|
| Array | Details of the errors detected while validating the passed lead and lead line item object. Returns an empty array if no errors are detected. For example: [ {"email":"Invalid email address."}, {"last_name":"Mandatory field is either missing or invalid."}, {"lead_line_items[0]/product_offering":"Mandatory field is either missing or invalid."} ] These error messages are located in the LeadAPIConstantsOOB script include. |
[Table 4. Returns]

{#LAVU-valLeadObjectForPostCall_O__table_hgp_t1s_ydc}  
The following code example shows where to add your custom code for the validateLeadObjectForPostCall() method in the LeadAPIValidationUtil script include.

    var LeadAPIValidationUtil = Class.create(); 

    LeadAPIValidationUtil.prototype = Object.extendsObject(LeadAPIValidationUtilOOB, { 

    // Define overriding functions here 

    validateLeadObjectForPostCall: function(leadObject) { 
    // Add your custom code
    }, 

    type: 'LeadAPIValidationUtil' 

    }); 


