Mass Edit Parameter Options Filterer
  • 27 Jun 2023
  • 1 Minute to read
  • Dark
    Light

Mass Edit Parameter Options Filterer

  • Dark
    Light

Article summary

This Apex hook is used with the optional Mass Edit feature. Mass Edit allows a user to use a single action to change selected lines in the Line Items list or Workspace. A single Mass Edit action can require parameters that the user has to enter. A parameter can be of type Picklist.

This hook allows the configurator to control the options a user sees in the picklist based on the current context of a deal and that user. For example, the Picklist parameter may represent available Locations that some users are not allowed to use. In that case, these values can be filtered based on the user ID.

This hook occurs when the parameters of the type Picklist are rendered, before the user selects them to see available values.

Apex hook class

  • It must implement the zpl.MassEditParameterOptionsFilterer interface.
  • It must have a global access modifier.
  • You must specify the Apex hook class name in the Mass Edit Parameter Options Filterer field of the Mass Edit Policy Type.

Interface definition

/**
 * Interface for the hook class for filtering picklist options in configured User Entered Parameters
 * of the Picklist type for the Mass Edit Policy Type.
 *
 * @param currentParameter the User Entered Parameter for which the list of available options is configured
 * @param defaultParameterOptions default list of options for the current User Entered Parameter
 * @param allParameters list of the User Entered Parameters configured for the Mass Edit Policy Type
 * @param headerRecordId the ID of current Header object record (ID of Contract or Price Lookup record)
 *
 * @returns a new list of options that will be displayed to user for selection for the current User Entered Parameter.
 */
global interface MassEditParameterOptionsFilterer
{
    List<PicklistValue> getFilteredOptions(
            UserEnteredParameter__c currentParameter,
            List<PicklistValue> defaultParameterOptions,
            UserEnteredParameter__c[] allParameters,
            Id headerRecordId);
}

Example of class implementation

global with sharing class SimpleMassEditParameterOptionsFilterer implements zpl.MassEditParameterOptionsFilterer
{
    global List<PicklistValue> getFilteredOptions(UserEnteredParameter__c currentParameter,
            List<PicklistValue> defaultParameterOptions, UserEnteredParameter__c[] allParameters, Id headerRecordId)
    {
        if (currentParameter.DisplayName__c.equals('Select an option'))
        {
            List<PicklistValue> picklistValues = new List<PicklistValue>();
            picklistValues.add(new PicklistValue('test1', 'test1', false, false));
            picklistValues.add(new PicklistValue('test2', 'test2', false, false));
            return picklistValues;
        }
        else
        {
            return defaultParameterOptions;
        }
    }
}


Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.