Org Documentor — Flag Non-Display Fields

Introduction

Towards the end of 2020, I pushed an update to the Org Documentor plug-in to include details of the page layouts that a field is referenced in. When I posted this on Linked In, I got the following comment from Anand Narasimhan (a blast from the past from the early days of the CTA program) :

Which chimed with some of the comments I’d received when I was asked to add this, around helping to retire old fields that weren’t used any more. This didn’t seem like it would take a huge amount of work to implement, so I added an issue to the Github repository and forgot about it until today.

Solution

It certainly didn’t take a huge amount of effort. As detailed when adding the page layout reference information, I build up a map of the page layouts that reference a field keyed by the field name. As I’m building a complex JavaScript object to pass to the EJS templating framework, I add the list of page layouts to a field property named pageLayoutInfo. It was then simply a matter of setting the background colour for the field if the pageLayoutInfo property was empty. The slight complication was that if the field has been determined to be in an error (missing description) or warning (todo, deprecated in the field description) then it would already have a background colour and I wanted to leave that in place.

All told, this was 4 lines of code (could be reduced to 3 with a wider screen ;):

if ( (!field.pageLayoutInfo) && 
(''==field.background) ) {
field.background='#f5dfea';
}

Bonus Changes

In response to an issue raised from the community, I also added the ability to configure the name of the report subdirectory for a metadata type via the reportDirectory property in the configuration file. The sample repository has been updated to write the pages pertaining to the objects metadata to the objs directory. If you don’t provide the reportDirectory property, it will default to the metadata type name — e.g. objects, triggers. I’ve also added an issue to document the configuration file properties, as right now there is an example file and I leave everyone to draw their own conclusions.

I also fixed a bug in the aura enabled pages that detail the Apex controller classes for aura components — if the component extended a super component it all went to hell, but now it handles that correctly.

Updated Plug-in

Version 3.4.6 of the plug-in has this new functionality and can be found on NPM.

If you already have the plug-in installed, just run sfdx plugins:update to upgrade to 3.4.6 — run sfdx plugins once you have done that to check the version.

if you aren’t already using it, check out the dedicated page to read more about how to install and configure it.

The source code for the plug-in can be found in the Github repository.

Originally published at http://bobbuzzard.blogspot.com.

CTO at BrightGen, author Visualforce Development Cookbook, multi Salesforce Developer MVP. Salesforce Certified Technical Architect. I am the one who codes.