Purpose

This script supports purchase request approval for Vendor records. It reads setup fields, applies validation, and updates process status when records meet the configured conditions.

Behavior

  • Reads the current record and related configuration fields.
  • Validates the record against the process rules documented on this page.
  • Updates status, queue, or review fields used by saved searches and workflows.
  • Logs skipped records with enough detail for support review.

Runtime and deployment

AreaSetting
Script typeClient Script
Deployed toVendor
StatusReleased
Log levelAudit

Operational notes

  • Review linked fields and searches before changing this script.
  • Test with a small set of records before enabling broad changes.
  • Check execution logs after deployment changes.

CSDocs Script Source

/**
 * @NApiVersion 2.1
 * @NScriptType ClientScript
 * @author Maya Chen
 */
define(["N/record", "N/search", "N/log"], function (record, search, log) {
  function purchaseRequestApproval(context) {
    var recordType = "vendor"
    var project = "Expense Approval Routing"
    log.audit({ title: project, details: "Demo processing for " + recordType })
    return true
  }
  return {
    execute: purchaseRequestApproval,
    beforeSubmit: purchaseRequestApproval,
    onRequest: purchaseRequestApproval,
  }
})

This object references:

  • Expense Approval Routing - connected through the purchase request approval process.
  • vendor - connected through the purchase request approval process.

Technical reference

Record identity

ItemValue
Record nameExpense Approval Routing Client
Script IDcustomscript_demo_purchase_request_approval_client_24
Object typeClient Script
Source XMLObjects/customscript_demo_purchase_request_approval_client_24.xml

Project assignment

ItemValue
Primary projectExpense Approval Routing
Record typesVendor