ProductFilter Class

This APEX class provides programmatic access to the TPM Promotion Product Filter used in the Promotion. This Product Filter defines the Products that are included in the Promotion.

The following are methods for TPM_ProductFilter.

Serializes the product filter information into a String used for storage.

55

global String toJSON()

Returns a list of all the Manual Products included in the Product filter.

55

global List<ManualProduct> getManualProducts

Returns the selected criteria values for the given criteria field. The Criteria field must be a Product2 SObject field. If the criteria field is not part of the Product Filter Criteria, an empty array is returned.

55

global List<String> getCriteriaValues(SObjectField criteria)

Adds a Manual Product to the Product Filter. The parameters are the product id to manually included and a flag to include or exclude it.

55

global Object toGenericObject(Id productId, Boolean included)

Serializes the product filter information into a generic object. Useful for usage on remote calls.

55

global Object toGenericObject()

Returns all Product2 SObject fields used in the Product Filter criteria.

55

global Set<SObjectField> getCriteriaFields()

Creates an empty product filter.

55

global TPM_ProductFilter()

Loads the Product Filter information from the parameter generic object. The current instance will be cleared and the product filter represented by the payload will be loaded.

55

global TPM_ProductFilter load(Object data)

Loads the serialized Product Filter information into the current instance. The current instance will be cleared and the product filter represented by the payload will be loaded.

55

global TPM_ProductFilter load(String payload)

Removes all information from the Product Filter and makes it empty.

55

global void clear()

Removes all Criteria filters from the ProductFilter instance.

55

global void clearCriteria()

Removes the Criteria filter for the given criteria field. The Criteria field must be a Product2 SObject field.

55

global void removeCriteria(SObjectField criteria)

Removes the manual product passed as a parameter. If the manual product is not part of the product filter manual products, the parameter will not be removed.

55

global void removeManualProduct(ManualProduct mp)

Sets the values for the given criteria field. The Criteria field must be a Product2 SObject field.

55

global void setCriteriaValues(SObjectField criteria, List<String> values)