Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
TokenUtility Class
Namespace
Example
Call the generateToken() method to generate a single token for a specified Salesforce record ID:
1Individual individual = [SELECT Id FROM Individual LIMIT 1];
2String token = pref_center.TokenUtility.generateToken(individual.Id);
3// Do something with the token
4System.debug(token)Call the generateTokens() method to generate tokens in bulk when given a list of Salesforce record IDs:
1List<Id> individualIds = new List<Id>();
2// Get Ids of Individuals who have not opted out of tracking
3for (Individual individual : [SELECT Id FROM Individual WHERE HasOptedOutTracking = false]) {
4 individualIds.add(individual.Id);
5}
6// Generate tokens for the list of Individual record Ids
7Map<String, String> tokens = pref_center.TokenUtility.generateTokens(individualIds);
8String firstIndividualId = individualIds[0];
9// The returned Map has the input record Id as key and the corresponding token as value
10String tokenForFirstIndividual = tokens.get(firstIndividualId);
11// Do something with the token
12System.debug(tokenForFirstIndividual);TokenUtility Methods
The following are methods for TokenUtility.
generateToken(tokenValue, tokenType)
Signature
public static String generateToken(String tokenValue, pref_center.TokenType tokenType)
Parameters
- tokenValue: Type: String The value passed to LoadParameters.getRecordId() and SubmitParameters.getRecordId(). Identifies the entity that the preference form is acting on.
- tokenType: Type: pref_center.TokenType Specifies the type of the value to be encrypted with authentication tokens.
Return Value
Type: String
generateToken(tokenValue)
Signature
public static String generateToken(String tokenValue)
Parameters
- tokenValue: Type: String Identifies the entity that the preference form is acting on. The value passed to LoadParameters.getRecordId() and SubmitParameters.getRecordId().
Return Value
Type: String
generateTokens(tokenValues, tokenType)
Signature
public static Map<String,String> generateTokens(List<String> tokenValues, pref_center.TokenType tokenType)
Parameters
- tokenValues: Type: List<String> The values passed to LoadParameters.getRecordId() and SubmitParameters.getRecordId(). Identifies the entity that the preference form is acting on. Contains multiple values to be encrypted with authentication tokens.
- tokenType: Type: pref_center.TokenType Specifies the type of the value to be encrypted with authentication tokens.