Newer Version Available

This content describes an older version of this product. View Latest

LearningItemSerializeDeserializer Class

Serializes and deserializes the content associated with a custom exercise when migrating an Enablement program from one org to another.

Namespace

sfdc_enablement

Usage

The class contains methods to serialize and deserialize custom exercise content between orgs when an Enablement program that includes a custom exercise is migrated from one org to another through change sets or packaging.

Extend the sfdc_enablement.LearningItemSerializeDeserializer Apex abstract class and add the class name to the ApexSerializerDeserializer field of the LearningItemType metadata record. If you don’t add the class name to the LearningItemType metadata record, the customContent property for the custom exercise is empty in the destination org and no corresponding LearningItem record is created for the exercise’s EnblProgramTaskDefinition record.

The serialize method serializes the custom content of the learning item from the source org. This method is called when you retrieve custom content from the source org.

The deserialize method is called during the deployment of a program. This method takes the serialized custom content, recreates the custom object record in the target org, and returns a new learning item record ID.

Example

The sample code serializes and deserializes the custom content for a given learning item of a custom screen flow exercise in an Enablement program. For this example to work, make sure the screen flow exists in the target org.

LearningItemSerializeDeserializer Methods

The following are methods for LearningItemSerializeDeserializer.

deserialize(serializedOutput)

Deserializes the provided custom content string and returns the record ID of the learning item.

Signature

public String deserialize(String serializedOutput)

Parameters

serializedOutput
Type: String
The serialized information of custom content associated with a learning item The serialize(learningItemId) method returns this information as a string that is less than or equal to 250 characters.

Return Value

Type: String

The ID of the learning item created for the target org.

serialize(learningItemId)

Serializes the custom content associated with the specified learning item. The serialized string represents the metadata of the custom content and is used to recreate the custom content in the target Salesforce org during deployment.

Signature

public String serialize(String learningItemId)

Parameters

learningItemId
Type: String
The ID of the learning item associated with the custom content to be serialized.

Return Value

Type: String

The serialized information of the custom content of the specified learning item. The format is a string that’s less than or equal to 250 characters long.