Best Practices for WebClient Event Handlers in Retail Pro Prism

In the Retail Pro Prism WebClient API, event handlers/listeners are provided for 3 different events of a Model, such as a document, document item, customer, etc.:

  1. Insert
  2. Save
  3. Delete

Before and After event handlers are provided for the above-mentioned events of a Model. These event handlers are useful for customizations in different events of a Model.

Possible Customizations

Below are some possible customizations on Customer, Document, and Document Item Models:

Customer Model:

  • Create/Insert: Convert First and Last Name to upper case

Document Model: 

  • Create/Insert: Show message or add associate in creation of each document
  • Update/Save: Track when the document is finalized or updated after finalization

Document Item:

  • Add/Insert: Validate whether an item can be added, or doing other checking or validation when an item is inserted
  • Update/Save: Track an item's price/qty related changes
  • Delete/Remove: Check or validate whether an item can be deleted, or doing other checking or validation on deletion of an item

 

In this article, two different customizations are being shown:

  1. Converting Customer's First and Last Name to Uppercase
  2. Showing Message on Document Creation and Finalization of Document

 

Note:

  • Chrome browser is used for Retail Pro Prism
  • Visual Studio Code is used as html and Javascript editor

 

 

 

WebClient Customization for Converting Customer's First and Last Name to Uppercase

 

1. CREATING THE JAVASCRIPT CODE Use the following javascript code to change the First and Last Name to upper case before inserting or saving a customer.

javascript code for customer name customization

 

2. STORAGE Customization-related files should be stored in the Retail Pro Prism WebClient plugins directory ("C:\ProgramData\RetailPro\Server\WebClient\plugins"), since the folders and files in this directory are not updated or removed while applying Retail Pro Prism updates.

Create a subdirectory called "Customer" to store the customization file, and a subdirectory called "js" within the "Customer" directory to store the above javascript file as "custConfig.js."

 

3. REGISTER CUSTOMIZATION - The customization-related file needs to register in Retail Pro Prism WebClient. Add the following code in the "C:\ProgramData\RetailPro\Server\WebClient\customization.html" file:

Register the customer name customization

 

 

WebClient Customization for Showing Message on Document Creation and Finalization

 

1. JAVASCRIPT CODE - Use the following javascript code to show "New Document created…"and "Document finalized" messages on the creation and finalization or update of document:

Javascript code for document message customization

               

2. STORAGE Customization related files should be stored in Retail Pro Prism WebClient plugins directory ("C:\ProgramData\RetailPro\Server\WebClient\plugins"), as the folders and files in this directory are not updated or removed while applying Retail Pro Prism updates.

Create a subdirectory called "Document" to store the customization file, and a subdirectory called "js" within the "Document" directory to store the javascript file as "docConfig.js."

 

3. REGISTER CUSTOMIZATION The customization-related file needs to register in Retail Pro Prism WebClient. Add the following code in the "C:\ProgramData\RetailPro\Server\WebClient\customization.html" file:

Register the document message customization

Published on Feb 23, 2021 in Customization, Automated Processes

 

Find Another Article