Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

Cloned Widget Code Documentation Best Practice

johnvpr
ServiceNow Employee

Customization should contain clear documentation within the code.

 

General Description should Include: 

  • Original OOB widget source and last update date. 
  • Description of custom functionality added. 
  • List of related tables, workflows, pages, integrations, or scripts. 

Inline Code Comments should  Use Standard Markers: 

 

//This widget was cloned from: "weather" widget – updated 01-01-2025 
//Functionality added: Ability to switch between Celsius and Fahrenheit 
//Related integrations: Weather API – /apiurl.do 
 
//JP START – 01-01-2025 – STRY0030173 – Commenting OOB call  
// data.load_config = options.load_config; 
// if (data.load_config === "async" && !input) 
//   return; 
//JP END 
 
data.quickLinkHeader = gs.getMessage(options.title); 
data.instanceId = $sp.getDisplayValue("sys_id"); 
 
//JP START – 01-01-2025 – STRY0030173 – Adding API call functionality 
// Info: Uses API /apiurl.do – documentation at /documentation/ 
var quickLinkId = $sp.getParameter("quick_link_id"); 
var pageId = $sp.getParameter("id"); 
var startTime = new GlideDateTime(); 
//JP END 
 
data.portal = $sp.getPortalRecord(); 
var quickLinkUtil = new sn_ex_sp.QuickLinkUtil(); 


 

Adhering to these standards ensures long-term maintainability, supportability, and smoother platform upgrades. 

1 REPLY 1

kaushal_snow
Giga Sage

Thanks for sharing !!

 

Thanks and Regards,
Kaushal Kumar Jha - ServiceNow Technical Consultant/Developer