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.

Namespace 

1cgcloud

TPM_ProductFilter Methods 

The following are methods for TPM_ProductFilter.

global String toJSON 

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

API Version 

55

Signature 

global String toJSON()

global List<ManualProduct> getManualProducts 

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

API Version 

55

Signature 

global List<ManualProduct> getManualProducts

global List<String> getCriteriaValues 

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.

API Version 

55

Signature 

global List<String> getCriteriaValues(SObjectField criteria)

global ManualProduct addManualProduct 

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.

API Version 

55

Signature 

global Object toGenericObject(Id productId, Boolean included)

global Object toGenericObject 

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

API Version 

55

Signature 

global Object toGenericObject()

global Set<SObjectField> getCriteriaFields 

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

API Version 

55

Signature 

global Set<SObjectField> getCriteriaFields()

global TPM_ProductFilter 

Creates an empty product filter.

API Version 

55

Signature 

global TPM_ProductFilter()

global TPM_ProductFilter load 

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.

API Version 

55

Signature 

global TPM_ProductFilter load(Object data)

global TPM_ProductFilter load 

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.

API Version 

55

Signature 

global TPM_ProductFilter load(String payload)

global void clear 

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

API Version 

55

Signature 

global void clear()

global void clearCriteria 

Removes all Criteria filters from the ProductFilter instance.

API Version 

55

Signature 

global void clearCriteria()

global void removeCriteria 

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

API Version 

55

Signature 

global void removeCriteria(SObjectField criteria)

global void removeManualProduct 

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.

API Version 

55

Signature 

global void removeManualProduct(ManualProduct mp)

global void setCriteriaValues 

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

API Version 

55

Signature 

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