Custom Dunning Process Implementation plan with customer and project-based dunning

Overview of Custom Dunning Feature

Following is the overview for a custom dunning implementation of The custom dunning feature with customer and project based dunning.

Custom Dunning Feature is designed to automate the process of sending dunning emails to customers with overdue invoices. It involves several key components, including Map/Reduce scripts, client scripts, and custom records. The process ensures that customers are reminded of their overdue invoices and appropriate actions are taken based on the dunning procedure.

Key Components

  1. Map/Reduce Script:
  • Purpose: This script is responsible for generating the input data, processing each record, and summarizing the results.
  • Functions:
  • getInputData: Loads the dunning procedure configuration and filters the transactions based on the dunning procedure and other criteria.
  • map: Processes each transaction and prepares the data for the reduce stage.
  • reduce: Creates dunning tasks and sends dunning emails based on the processed data.
  • summarize: Logs the summary of the script execution and handles any errors.
  1. Client Script :
  • Purpose: This script handles client-side logic for customer and project records, ensuring that the appropriate dunning manager and sending type are set based on the dunning procedure.
  • Functions:
  • pageInit: Initializes the page and sets the dunning manager and sending type based on the dunning procedure.
  • fieldChanged: Makes the sending type field mandatory if a dunning procedure is selected.
  • saveRecord: Ensures that the sending type field is filled before saving the record.
  1. Library Script:
  • Purpose: This script contains utility functions used by the Map/Reduce script and other components.
  • Functions:
  • getAllResults: Retrieves all results from a SuiteScript search object.
  • getCustomerData: Retrieves customer data for a given customer ID.
  • getDunningAvailInv: Retrieves available invoices for dunning for a given customer ID.
  1. Custom Records:
  • Dunning Procedure Configuration (customrecord_pdg_dunning_procedure): Stores the configuration for each dunning procedure, including the dunning type, sending type, and associated searches.
  • Dunning Task (customrecord_pdg_dunning_task): Stores the dunning tasks created for each overdue invoice, including the task type, transaction, customer, and dunning level.
  • PDF Template Configuration (customrecord_pdg_pdf_template_config): Stores the configuration for PDF templates used in dunning emails, including the header, body, and footer templates.

Process Flow

  1. Initialization:
  • The Map/Reduce script (PDG_DUNNING_SCH_TRAN_MR.JS) is triggered to start the dunning process.
  • The getInputData function loads the dunning procedure configuration and filters the transactions based on the dunning procedure and other criteria.
  1. Processing Transactions:
  • The map function processes each transaction and prepares the data for the reduce stage.
  • The reduce function creates dunning tasks and sends dunning emails based on the processed data.
  1. Sending Dunning Emails:
  • The reduce function uses the email.send method to send dunning emails to customers with overdue invoices.
  • The emails are marked as internal only to ensure they are not sent outside of NetSuite.
  1. Creating Dunning Tasks:
  • The reduce function creates dunning tasks for each overdue invoice, storing the task type, transaction, customer, and dunning level in the customrecord_pdg_dunning_task record.
  1. Client-Side Logic:
  • The client script (PDG_CS_CUSTOMER_PROJECT_RECORD_PSADN29.JS) handles client-side logic for customer and project records, ensuring that the appropriate dunning manager and sending type are set based on the dunning procedure.
  1. Utility Functions:
  • The library script (PDG_DUNNING_LIB.JS) provides utility functions for retrieving search results, customer data, and available invoices for dunning.

Leave a comment

Your email address will not be published. Required fields are marked *