Newer Version Available
LearningItemSerializeDeserializer Class
Namespace
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)
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.
serialize(learningItemId)
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.