Foundations Apex API Developer Reference

fferpcore.FeatureConsoleService

global with sharing class FeatureConsoleService

Retrieve and activate Feature Console features and steps.

Methods

readFeatures

global static List<fferpcore.FeatureConsoleService.Feature> readFeatures()

Reads all available features from the database and whether or not they are enabled.

Return Value

The list of all features

readFeatures

global static List<fferpcore.FeatureConsoleService.Feature> readFeatures(Set<String> qualifiedFeatureNames)

Reads the specified features from the database and whether or not they are enabled.

Input Parameters

Name Type Description
qualifiedFeatureNames Set<String> The qualified API names of the feature to read.

Return Value

The list of features for the given names.

readFeatureSteps

global static List<fferpcore.FeatureConsoleService.Step> readFeatureSteps(Set<String> qualifiedFeatureNames)

Reads all feature steps from the database for a given set of features and whether or not they have been marked as completed.

Input Parameters

Name Type Description
qualifiedFeatureNames Set<String> The qualified API names of the features to read steps for.

Return Value

The list of all feature steps for the given features.

readFeatureSteps

global static List<fferpcore.FeatureConsoleService.Step> readFeatureSteps(Set<String> qualifiedFeatureNames, fferpcore.FeatureConsoleService.ReadFeatureStepsOptions options)

Reads all feature steps from the database for a given set of features and whether or not they have been marked as completed.

Input Parameters

Name Type Description
qualifiedFeatureNames Set<String> The qualified API names of the features to read steps for.
options fferpcore.FeatureConsoleService.ReadFeatureStepsOptions The options to use when reading the steps.

Return Value

The list of all feature steps for the given features.

enable

global static fferpcore.FeatureConsoleService.ActivationResponse enable(Id recordId)

Marks a given feature or feature step as enabled or completed.

To enable a feature step that updates org metadata, call the method twice:

  • The first call updates the activation record to mark the feature step as In Progress.
  • The second call performs the callout to the Metadata API.
Perform each of the calls using a different execution context, for example, using a batch job, Visualforce page, or Lightning web component.
To check whether a second call is required, use the PleaseResubmit property in the ActivationResponse.

Input Parameters

Name Type Description
recordId Id The ID of the custom metadata record representing the feature or step to enable.

Return Value

Whether the enable request was successful and if not any errors encountered.

enable

global static fferpcore.FeatureConsoleService.ActivationResponse enable(Id recordId, String options)

Marks a given feature or feature step as enabled or completed.

To enable a feature step that updates org metadata, call the method twice:

  • The first call updates the activation record to mark the feature step as In Progress.
  • The second call performs the callout to the Metadata API.
Perform each of the calls using a different execution context, for example, using a batch job, Visualforce page, or Lightning web component.
To check whether a second call is required, use the PleaseResubmit property in the ActivationResponse.

Input Parameters

Name Type Description
recordId Id The ID of the custom metadata record representing the feature or step to enable.
options String Non-persistent data that is used when performing or reverting the feature step, such as user selections for optional actions.

Return Value

Whether the enable request was successful and if not any errors encountered.

run

global static List<fferpcore.FeatureConsoleService.ActivationResponse> run(List<fferpcore.FeatureConsoleService.RunRequest> requests)

Run multiple steps using the specified step types and configurations.
This does not require any feature or feature step custom metadata records.
This does not require multiple invocations.

Input Parameters

Name Type Description
requests List<fferpcore.FeatureConsoleService.RunRequest> A list of RunRequest, each containing a step type and associated configuration data.

Return Value

A list of ActivationResponse, one per request. Each indicating success or failure and any associated errors.

disable

global static fferpcore.FeatureConsoleService.ActivationResponse disable(Id recordId)

Marks a given feature or feature step as disabled or not completed.

Input Parameters

Name Type Description
recordId Id The ID of the custom metadata record representing the feature or step to disable.

Return Value

Details of whether the request was successful and any associated error messages.

disable

global static fferpcore.FeatureConsoleService.ActivationResponse disable(Id recordId, String options)

Marks a given feature or feature step as disabled or not completed.

Input Parameters

Name Type Description
recordId Id The ID of the custom metadata record representing the feature or step to disable.
options String Non-persistent data that is used when performing or reverting the feature step, such as user selections for optional actions.

Return Value

Details of whether the request was successful and any associated error messages.

skip

global static fferpcore.FeatureConsoleService.ActivationResponse skip(Id recordId)

Marks a given feature step as skipped.

Input Parameters

Name Type Description
recordId Id The ID of the custom metadata record representing the step to skip.

Return Value

Details of whether the request was successful and any associated error messages.

revertSkip

global static fferpcore.FeatureConsoleService.ActivationResponse revertSkip(Id recordId)

Marks a given feature step that has been skipped as not completed.

Input Parameters

Name Type Description
recordId Id The ID of the custom metadata record representing the step to mark as not completed.

Return Value

Details of whether the request was successful and any associated error messages.

isFeatureEnabled

global static Map<String, Boolean> isFeatureEnabled(Set<String> qualifiedFeatureNames)

Determines whether a given set of features have been enabled.

Input Parameters

Name Type Description
qualifiedFeatureNames Set<String> The qualified API names of the features to check.

Return Value

A map of the qualified API names of the passed in features against whether they are enabled.

isFeatureStepEnabled

global static Map<String, Boolean> isFeatureStepEnabled(Set<String> qualifiedFeatureStepNames)

Determines whether a given set of feature steps have been enabled.

Input Parameters

Name Type Description
qualifiedFeatureStepNames Set<String> The qualified API names of the feature steps to check.

Return Value

A map of the qualified API names of the passed in feature steps against whether they are enabled.

getLogLines

global static List<fferpcore.FeatureConsoleService.LogLine> getLogLines(Set<String> qualifiedFeatureNames)

Reads all of the LogLines associated with the given set of features.

Input Parameters

Name Type Description
qualifiedFeatureNames Set<String> The qualified API names of the features.

Return Value

A list of requested LogLines.

markAsPerformed

global static void markAsPerformed(Boolean isEnable, Id recordId, LoggingLevel severity)

Mark a feature or step as performed.

Input Parameters

Name Type Description
isEnable Boolean Whether we are trying to enable or disable.
recordId Id The ID of the feature or step record to mark as performed.
severity LoggingLevel The highest logging level used for any issues logged during enabling or disabling. Used to set the status of the feature or step.

markAsPerformed

global static void markAsPerformed(Boolean isEnable, Id recordId, LoggingLevel severity, String memento)

Mark a feature or step as performed.

Input Parameters

Name Type Description
isEnable Boolean Whether we are trying to enable or disable.
recordId Id The ID of the feature or step record to mark as performed.
severity LoggingLevel The highest logging level used for any issues logged during enabling or disabling. Used to set the status of the feature or step.
memento String Persistent data that is used when performing or reverting the feature step, such as previous state values or user selections in wizards.

markAsError

global static void markAsError(Boolean isEnable, Id recordId, Exception e)

Mark a feature or step as having had an error.

Input Parameters

Name Type Description
isEnable Boolean Whether we are trying to enable or disable.
recordId Id The ID of the feature or step record to mark as having had an error.
e Exception The exception causing the error.

markAsError

global static void markAsError(Boolean isEnable, Id recordId, LoggingLevel severity, String error)

Mark a feature or step as having had an error.

Input Parameters

Name Type Description
isEnable Boolean Whether we are trying to enable or disable.
recordId Id The ID of the feature or step record to mark as having had an error.
severity LoggingLevel The severity of the error.
error String A detail message for the error

markAsSuccess

global static void markAsSuccess(Boolean isEnable, Id recordId)

Mark a feature or step as successful.

Input Parameters

Name Type Description
isEnable Boolean Whether we are trying to enable or disable.
recordId Id The ID of the feature or step record to mark as successful.

log

global static void log(fferpcore.FeatureConsoleService.LogRequest request)

Log a message against the running of a particular feature or step.

Input Parameters

Name Type Description
request fferpcore.FeatureConsoleService.LogRequest Request object containing the details of what to log and against which feature or step.

fferpcore.FeatureConsoleService.Feature

global inherited sharing class Feature

Wrapper for a Feature Console feature and information about whether it is visible and has been enabled.

Properties

Name Type Description
Record FeatureConsoleFeature__mdt The custom metadata object representing the feature.
IsActive Boolean Whether the feature has been enabled.
IsHidden Boolean Whether the feature is visible in the Feature Console.

Methods

Feature

global Feature()

getCanToggle

global Boolean getCanToggle()

fferpcore.FeatureConsoleService.Step

global inherited sharing class Step

Wrapper for a Feature Console feature step and whether it has been marked as completed.

Properties

Name Type Description
Record FeatureConsoleFeatureStep__mdt The custom metadata object representing the feature step.
IsActive Boolean Whether the feature step has been marked as completed.

Methods

Step

global Step()

fferpcore.FeatureConsoleService.ActivationResponse

global inherited sharing class ActivationResponse

Response returned when enabling or disabling a step or feature.

Properties

Name Type Description
Success Boolean Whether the feature or step was successfully enabled or disabled.
Messages List<String> A list of the errors if the request was not successful.
PleaseResubmit Boolean true if the client needs to resubmit the request to allow completion in a new execution context.

Methods

ActivationResponse

global ActivationResponse()

fferpcore.FeatureConsoleService.LogLine

global inherited sharing class LogLine

A line of logging generated when performing a feature or step

Properties

Name Type Description
Feature String The feature this log relates to
Step String The step this log relates to, if any.
Severity String The seriousness of the event
Message String A description of the event
ActivationNumber Integer The activation number - log lines with the same activation number relate to the same feature activation.

Methods

LogLine

global LogLine()

fferpcore.FeatureConsoleService.StepRunnerConfig

global inherited sharing class StepRunnerConfig

The information passed to a custom Apex runner when running a feature step.

Properties

Name Type Description
IsEnable Boolean Whether we are trying to enable or disable the step.
ParamsByType Map<String, List<FeatureConsoleFeatureParameter__mdt>> The parameters for the step being run mapped by their parameter types.
StepRecordId Id The ID of the custom metadata record for the step we are trying to run.
Memento String Persistent data that is used when performing or reverting the feature step, such as previous state values or user selections in wizards.
UserData String Non-persistent data that is used when performing or reverting the feature step, such as user selections for optional actions.
Configuration String The configuration data for the step, typically in JSON format. If provided and supported by the step, this will be used instead of ParamsByType.
IsOptional Boolean Whether the step is marked as optional or not.
IsRevertDisabled Boolean Whether the revert action is disabled on the feature step. If the revert action is disabled, you cannot revert the feature step after it has been completed.

Methods

StepRunnerConfig

global StepRunnerConfig()

getMementoDeserializedUntyped

global Map<String, Object> getMementoDeserializedUntyped()

Deserialize the Memento as an untyped JSON string. If the memento is blank or null then an empty Map is returned.

Return Value

The Memento as a Map of String to Value.

fferpcore.FeatureConsoleService.LogRequest

global inherited sharing class LogRequest

Wrapper for the information required to log a message against the running of a step or feature.

Properties

Name Type Description
IsEnable Boolean Whether we are trying to enable or disable the feature or step.
RecordId Id The ID of the feature or step record we are trying to log the message against.
Severity LoggingLevel The severity to log the message under.
Detail String The message to log against the feature or step.

Methods

LogRequest

global LogRequest()

fferpcore.FeatureConsoleService.StepDescriptionLine

global inherited sharing class StepDescriptionLine

fferpcore.FeatureConsoleService.ReadFeatureStepsOptions

global inherited sharing class ReadFeatureStepsOptions

A wrapper for the options used when reading feature steps.

Properties

Name Type Description
ResolveLabels Boolean A flag indicating whether to resolve labels when reading a Feature Step description. This defaults to true so will fail if called outside of a VisualForce context.

Methods

ReadFeatureStepsOptions

global ReadFeatureStepsOptions()

fferpcore.FeatureConsoleService.RunRequest

global inherited sharing class RunRequest

An object to hold a Step Type and its relevant configuration, used when running steps without the use of custom metadata records.

Properties

Name Type Description
StepType String Name of the Step Type to run.
Configuration String The configuration data for the associated step type, typically in JSON format .

Methods

RunRequest

global RunRequest(String stepType, String configuration)

© Copyright 2009–2023 Certinia Inc. All rights reserved. Various trademarks held by their respective owners.