Skip to content
Tom Carman edited this page Jun 27, 2024 · 55 revisions

no-missing-description-on-objects

Purpose

Checks that the "Description" field is populated on custom objects.

Rule Details

Short Description

Custom objects should have a description.

Full Description

Custom objects should have a description describing the purpose of the object. Populate the 'Description' field on the custom object.

Metdata Types

  • Custom Object

Examples

Example of incorrect metadata for this rule

<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
    <deploymentStatus>Deployed</deploymentStatus>
    <label>Car</label>
    <nameField>
        <encryptionScheme>None</encryptionScheme>
        <label>Car Name</label>
        <trackHistory>true</trackHistory>
        <type>Text</type>
    </nameField>
    <pluralLabel>Cars</pluralLabel>
</CustomObject>

Example of correct metadata for this rule

<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
    <deploymentStatus>Deployed</deploymentStatus>
    <description>Car</description>
    <label>Car</label>
    <nameField>
        <encryptionScheme>None</encryptionScheme>
        <label>Car Name</label>
        <trackHistory>true</trackHistory>
        <type>Text</type>
    </nameField>
    <pluralLabel>Cars</pluralLabel>
</CustomObject>

Implementation

Source: src/rules/no-missing-description-on-objects.ts


no-missing-description-on-fields

Purpose

Checks that the "Description" field is populated on custom fields.

Rule Details

Short Description

Custom fields should have a description.

Full Description

Custom fields should have a description describing the purpose of the field. Populate the 'Description' field on the custom field.

Metdata Types

  • Custom Field

Examples

Example of incorrect metadata for this rule


Example of correct metadata for this rule


Implementation

Source: src/rules/no-missing-description-on-fields.ts


no-missing-description-on-flows

Purpose

Checks that the "Description" field is populated on flows.

Rule Details

Short Description

Flows should have a description.

Full Description

Flows should have a description describing the purpose of the flow. Populate the 'Description' field on the flow.

Metdata Types

  • Flow

Examples

Example of incorrect metadata for this rule


Example of correct metadata for this rule


Implementation

Source: src/rules/no-missing-description-on-flows.ts


no-missing-description-on-validation-rules

Purpose

Checks that the "Description" field is populated on validation rules.

Rule Details

Short Description

Validation rules should have a description.

Full Description

Validation rules should have a description describing the purpose of the validation rule. Populate the 'Description' field on the validation rule.

Metdata Types

  • Validation Rule

Examples

Example of incorrect metadata for this rule


Example of correct metadata for this rule


Implementation

Source: src/rules/no-missing-description-on-validation-rules.ts


description-min-length-on-objects

Purpose

Checks that the "Description" field on custom objects meets a minimum length.

Rule Details

Short Description

Custom object descriptions should be at least {option.minimumLength} characters long.

Full Description

Custom object descriptions should be at least {option.minimumLength} characters long. Update the 'Description' field on the custom object.

Metdata Types

  • Custom Object

Rule Options

Name Description Type Example
minimumLength (optional, defaults to 50) The minimum length that the custom object description should meet. integer 30

Examples

Example of incorrect metadata for this rule


Example of correct metadata for this rule


Implementation

Source: src/rules/description-min-length-on-objects.ts


description-min-length-on-fields

Purpose

Checks that the "Description" field on custom fields meets a minimum length.

Rule Details

Short Description

Custom field descriptions should be at least {option.minimumLength} characters long.

Full Description

Custom field descriptions should be at least {option.minimumLength} characters long. Update the 'Description' field on the custom field.

Metdata Types

  • Custom Field

Rule Options

Name Description Type Example
minimumLength (optional, defaults to 50) The minimum length that the custom field description should meet. integer 30

Examples

Example of incorrect metadata for this rule


Example of correct metadata for this rule


Implementation

Source: src/rules/description-min-length-on-fields.ts


description-min-length-on-flows

Purpose

Checks that the "Description" field on flows meets a minimum length.

Rule Details

Short Description

Flow descriptions should be at least {option.minimumLength} characters long.

Full Description

Flow descriptions should be at least {option.minimumLength} characters long. Update the 'Description' field on the flow.

Metdata Types

  • Flow

Rule Options

Name Description Type Example
minimumLength (optional, defaults to 50) The minimum length that the flow description should meet. integer 30

Examples

Example of incorrect metadata for this rule


Example of correct metadata for this rule


Implementation

Source: src/rules/description-min-length-on-flows.ts


description-min-length-on-validation-rules

Purpose

Checks that the "Description" field on validation rules meets a minimum length.

Rule Details

Short Description

Validation rule descriptions should be at least {option.minimumLength} characters long.

Full Description

Validation rule descriptions should be at least {option.minimumLength} characters long. Update the 'Description' field on the Validation rule.

Metdata Types

  • Validation Rule

Rule Options

Name Description Type Example
minimumLength (optional, defaults to 50) The minimum length that the validation rule description should meet. integer 30

Examples

Example of incorrect metadata for this rule


Example of correct metadata for this rule


Implementation

Source: src/rules/description-min-length-on-validation-rules.ts


error-message-min-length-on-validation-rules

Purpose

Checks that the "Error Message" field on validation rules meets a minimum length.

Rule Details

Short Description

Validation rule error messages should be at least {option.minimumLength} characters long.

Full Description

Validation rule error messages should be at least {option.minimumLength} characters long, and describe how the user should resolve the validation error. Update the 'Error Message' field on the Validation rule.

Metdata Types

  • Validation Rule

Rule Options

Name Description Type Example
minimumLength (optional, defaults to 50) The minimum length that the validation rule description should meet. integer 30

Examples

Example of incorrect metadata for this rule


Example of correct metadata for this rule


Implementation

Source: src/rules/error-message-min-length-on-validation-rules.ts


no-missing-prefix-on-metadata

Purpose

Some organisations want metadata prefixed with an identifier (eg. to distinguish work done by a partner from internal work).

Whilst this is often considered bad practice, this rule can be used to enforce it.

Rule Details

Short Description

Metadata should have a prefix.

Full Description

All metata must have an API name prefix of one of the following: {option.prefixes}. Update the API name to include the prefix.



or

Metadata of types: {option.types} should have one of the following prefixes: {option.prefixes}. Update the API name to include one the accepted prefixes.

Metdata Types

  • All custom metadata or
  • Types defined by the option.types rule option

Rule Options

Name Description Type Example
prefixes (required) The prefixes you want the rule to check against string (comma delimited) of prefixes ACME_, EC_
types (optional) The types of metadata you want this rule to run against. If not specified, the rule will run against all custom metadata. string (comma delimited) of metadata types, based on the file extension (case sensitive) - eg. For .flow-meta.xml use flow, for .validationRule-meta.xml use validationRule etc. field, fieldSet, listView
exclude-namespaces (optional) The namespace of any custom metadata you wish to exclude from the rule string (comma delimited) of namespaces FinServ__, et4ae5__

Examples

Example of incorrect metadata for this rule


Example of correct metadata for this rule


Implementation

Source: src/rules/no-missing-prefix-on-metadata.ts


no-prefix-on-metadata

Purpose

For organisations who use prefixes for metadata, this rule can be used to prevent the prefix from being applied to certain metadata (alternatively you could selectively apply the no-missing-prefix-on-metadata rule).

Alternatively this rule can be used in organisations that historically used prefixes, but now want to change the behaviour.

Rule Details

Short Description

Metadata API names should not have a prefix.

Full Description

Metadata API names should not be prefixed with any of the following: {option.prefixes}. Remove the prefix from the API name.



or

Metadata API names should not have a prefix of: {option.prefixes}. This applies to metadata of types: {option.types}. Remove the prefix from the API name.

Metdata Types

  • All custom metadata or
  • Types defined by the option.types rule option

Rule Options

Name Description Type Example
prefixes (required) The prefixes you want the rule to check against string (comma delimited) of prefixes ACME_, EC_
types (optional) The types of metadata you want this rule to run against. If not specified, the rule will run against all custom metadata. string (comma delimited) of metadata types, based on the file extension (case sensitive) - eg. For .flow-meta.xml use flow, for .validationRule-meta.xml use validationRule etc. field, fieldSet, listView
exclude-namespaces (optional) The namespace of any custom metadata you wish to exclude from the rule string (comma delimited) of namespaces FinServ__, et4ae5__

Examples

Example of incorrect metadata for this rule


Example of correct metadata for this rule


Implementation

Source: src/rules/no-prefix-on-metadata.ts


no-double-spaces-in-picklist-fields

Purpose

Whilst Salesforce automatically trims leading and trailing whitespace from picklist entries, it allows double spaces within the text. Additionally it hides the double space when viewing the picklist entry in the UI, unless you go to the edit page for it.

Double spaces are almost never intended, and often go unnoticed leading to unexpected behaviour within automations and integrations.

This rule checks for double spaces in either the label or value of the picklist entry.

Rule Details

Short Description

Picklist labels and values should not contain double spaces eg. 'Offer Made'.

Full Description

Picklist labels and values should not contain double spaces eg. 'Offer Made'. Remove the double space from the label and/or value.

Metdata Types

  • Custom Field of type 'Picklist' or 'MultiselectPicklist'

Examples

Example of incorrect metadata for this rule


Example of correct metadata for this rule


Implementation

Source: src/rules/no-double-spaces-in-picklist-fields.ts


no-double-spaces-in-value-sets

Purpose

Whilst Salesforce automatically trims leading and trailing whitespace from value set entries, it allows double spaces within the text. Additionally it hides the double space when viewing the value set entry in the UI, unless you go to the edit page for it.

Double spaces are almost never intended, and often go unnoticed leading to unexpected behaviour within automations and integrations.

This rule checks for double spaces in either the label or value of the value set entry.

Rule Details

Short Description

Value set labels and values should not contain double spaces eg. 'Offer Made'.

Full Description

Value set labels and values should not contain double spaces eg. 'Offer Made'. Remove the double space from the label and/or value.

Metdata Types

  • Standard Value Set
  • Global Value Set

Examples

Example of incorrect metadata for this rule


Example of correct metadata for this rule


Implementation

Source: src/rules/no-double-spaces-in-value-sets.ts