Skip to main content

Configure Extra Form Fields

Use Extra Form Fields to add custom Salesforce fields to existing Employee Hub forms. Configure each field with flair__Extra_Form_Field__mdt without replacing the form's default field set.

Who can use this?

Salesforce Admins who manage fields and the Flair Extra Form Field custom metadata type in Salesforce Setup. Employees see the fields in the Employee Hub.

Before you begin

  • Create the custom field on the target Salesforce object.
  • Record the object's API name and the field's API name.
  • Identify the form ID if the field should appear in one form only.

Review supported forms

FormForm ID
Absence Request Formflair__Absence__c.RequestAbsence
Absence Manager Detailsflair__Absence__c.ManagerDetails
Expense Request Formflair__Expense__c.RequestExpense
Expense Detailsflair__Expense__c.Details
Expense Item Request Formflair__Expense_Item__c.RequestExpenseItem
Project User Detailsflair__Project__c.UserDetails
Project Manager Detailsflair__Project__c.ManagerDetails
Projects Time Entry Editflair__Project_Time_Entry__c.Edit

Supported Salesforce field types are Text Area, Long Text Area, Date, Time, DateTime, Picklist, Lookup Reference, and Number.

Create an Extra Form Field

  1. In Salesforce Setup, enter Custom Metadata Types in Quick Find.
  2. Open Custom Metadata Types.
  3. Next to Flair Extra Form Field, click Manage Records.
  4. Click New.
  5. In Object API Name, enter the target object, such as flair__Expense__c or flair__Absence__c.
  6. In Field API Name, enter the field to display, such as flair__Amount__c or flair__Description__c.
  7. Configure any optional settings in Review Extra Form Field settings.
  8. Click Save.

Extra Form Field custom metadata record with field settings

Review Extra Form Field settings

SettingWhat it does
Object API NameIdentifies the Salesforce object. This setting is required.
Field API NameIdentifies the custom field to display. This setting is required.
RequiredMakes the field required in the Employee Hub form even when Salesforce does not require it.
ActiveShows the field. Clear it to hide the field without deleting the metadata record.
Form IdLimits the field to one form. Leave it empty to show the field in every supported form for the object.
PositionSets the display order. Lower numbers appear first.
Visibility ConditionStores the JSON condition that controls when the field appears.
Lookup SOQL FilterStores a SOQL WHERE clause that filters lookup options.
Visible LinesSets the number of visible lines for a multiline Text Area.

Configure a visibility condition

Visibility conditions use JSON criteria similar to MongoDB query syntax. They can read form values, record types, or context parameters.

Show a field for one record type

Use the Record Type Name API name, not the label:

{
"$formValues.recordTypeName": "Travel_Expense"
}

Show a field for one absence category

{
"$contextParams.absenceCategoryName": "Sickness"
}

Hide a field for selected values

{
"$contextParams.absenceCategoryName": {"$ne": ["Sickness", "Home Leave"]}
}

Combine conditions

Use $or for either record type:

{
"$or": [
{ "$formValues.recordTypeName": "Travel_Expense" },
{ "$formValues.recordTypeName": "Default_Expense" }
]
}

Use $or and $and for nested logic:

{
"$or": [
{ "$formValues.recordTypeName": "Travel_Expense" },
{
"$and": [
{ "$contextParams.absenceCategoryName": { "$ne": ["Sickness", "Home Leave"] } },
{ "$formValues.recordTypeName": "Default_Expense" }
]
}
]
}

The condition supports these operators and keys:

Operator or keyWhat it does
$eqTests equality. This is the default when no operator is present.
$neTests inequality.
$orPasses when one nested condition passes.
$andPasses when every nested condition passes.
$formValues.recordTypeNameReads the Record Type Name API name.
$contextParams.absenceCategoryNameReads the absence category in the Absence Request Form.
$contextParams.employeeAbsenceCategoryReads the employee absence category in the Absence Request Form.
$contextParams.dayReads the day in Projects Time Entry Edit.
$contextParams.projectReads the project in Projects Time Entry Edit.
$contextParams.employeeReads the employee in Projects Time Entry Edit.

Configure a lookup filter

For a Lookup Reference field, enter a SOQL WHERE clause in Lookup SOQL Filter.

Filter employees by manager

flair__Manager__c = :currentEmployee.Manager__c

Filter with a context parameter

Absence_Category__c = :contextParams.employeeAbsenceCategory.flair__Absence_Category__c

Filter with LIKE

flair__Manager__r.Name LIKE '%:currentEmployee.flair__First_Name__c%'

Combine lookup criteria

Ensurance_Number__c LIKE ':currentEmployee.Ensurance_Number__c%'
AND Some_Employee__c = :currentEmployee.flair__Manager__r.flair__Manager__c

Lookup filters support these dynamic parameters:

ParameterWhat it references
:currentEmployeeThe current employee record, such as :currentEmployee.flair__First_Name__c or :currentEmployee.Manager__c.
:contextParamsValues passed to the form, such as :contextParams.employeeAbsenceCategory.flair__Absence_Category__c.

Configure common field patterns

Show a medical certificate field for sickness

  1. On flair__Absence__c, create flair__Medical_Certificate_ID__c.

  2. Create an Extra Form Field with Object API Name set to flair__Absence__c.

  3. Set Field API Name to flair__Medical_Certificate_ID__c.

  4. Set Form Id to flair__Absence__c.RequestAbsence.

  5. Enter this Visibility Condition:

    {
    "$contextParams.absenceCategoryName": "Sickness"
    }
  6. Click Save.

Filter an expense allowance by employee

  1. On flair__Expense__c, create the lookup field flair__Expense_Allowance__c.

  2. Create an Extra Form Field with Object API Name set to flair__Expense__c.

  3. Set Field API Name to flair__Expense_Allowance__c.

  4. Enter this Lookup SOQL Filter:

    flair__Employee__c = :currentEmployee.Id
  5. Click Save.

Show a field for travel expenses

  1. On flair__Expense__c, create flair__Flight_Number__c.

  2. Create an Extra Form Field with Object API Name set to flair__Expense__c.

  3. Set Field API Name to flair__Flight_Number__c.

  4. Enter this Visibility Condition:

    {
    "$formValues.recordTypeName": "Travel_Expense"
    }
  5. Click Save.

Configure fields with inline JSON

Instead of custom metadata records, an object-level text field such as flair__Request_Form__c.flair__Extra_Fields_Config__c can store an array. Each item is a field API name or an object with field options.

Use an array of field names for a basic configuration:

["Name", "flair__Description__c"]

Add options to a field object:

["Name", {"flair__Description__c": {"visibleLines": 10}}]

Add a lookup filter:

["Name", {"Take_Over_Employee__c": {"lookupSOQLFilter": "flair__Manager__c = :currentEmployee.flair__Manager__c"}}]

Add a visibility condition:

["Name", {"flair__Usa_Notes__c": {"visibilityCondition": {"$formValues.recordTypeName": "Usa"}}}]

Inline JSON supports these options:

OptionTypeWhat it does
positionnumberSets the display order.
requiredbooleanOverrides the Salesforce required-field property.
visibleLinesnumberSets the number of lines for multiline Text Areas.
visibilityConditionstring or objectSets a JSON visibility condition.
lookupSOQLFilterstringSets a SOQL WHERE clause for a lookup.

Advanced configurations also support fieldApiName, objectApiName, formId, and active.

Troubleshooting

A field does not appear

  1. Confirm that Active is selected.
  2. Confirm that Object API Name and Field API Name use API names, not labels.
  3. Confirm that the field exists on the Salesforce object.
  4. Validate the JSON in Visibility Condition.
  5. Confirm that Form Id matches the displayed form.

A lookup filter does not work

  1. Validate the SOQL syntax.
  2. Confirm that :currentEmployee and :contextParams match the supported parameter names exactly.
  3. Confirm that every referenced field exists.
  4. Test the SOQL query in Salesforce Developer Console.

A visibility condition does not work

  1. Validate the JSON syntax.
  2. Confirm that the record type value is the API name, not the label.
  3. Confirm that the selected form supplies the context parameter.
  4. Test one condition before adding nested logic.