Develop Secure Code
ui*Api Supported Objects
evaluateLearningItem
evaluateLearningItemUse this wire adapter to check whether the criteria for completing a custom exercise in an Enablement program are satisfied.
1import { evaluateLearningItem } from 'lightning/uiLearningPlatformApi';
2
3evaluateLearningItem({
4 learningItemId: "04Qxx00000003AnEAI",
5 details: {
6 customComponent: "customComponent"
7 }
8}): Promise<LearningItemProgress>| Parameter Name | Type | Description | Required? |
|---|---|---|---|
learningItemId | String | The ID of the LearningItem record to evaluate. | ![]() |
details | Object | An optional Map<String, Object> that includes any additional information required for evaluating the learning item. The LearningItemType record that represents the custom exercise defines this criteria. |
id—The ID of the LearningItemProgress record.learningItemId—The ID of the LearningItem record that was evaluated.completedPercent—Percentage of the learning item that’s complete.completedDate—The date when the user completed the learning item.isCompleted—Whether the learning item is complete. The default value is false.error—A validation error for invalid fields.This example passes only the required learningItemId.
1import { evaluateLearningItem } from 'lightning/uiLearningPlatformApi';
2
3class Example extends LightningElement {
4 evaluateLearningItem({
5 learningItemId: "04Qxx00000003AnEAI"
6 }).then(() => {
7 //handle success
8 })
9}This example evaluates a user’s progress through a custom exercise that uses a screen flow. The optional details parameter includes information about the user’s current screen and the screens that the user has navigated already.
1import getScreenNames from '@salesforce/apex/ResourceController.getScreenNames';
2import { evaluateLearningItem } from 'lightning/uiLearningPlatformApi';
3
4class Example extends LightningElement {
5 screenNames;
6 evaluateLearningItem({
7 learningItemId: "04Qxx00000003AnEAI",
8 details: {
9 status: event.detail.status,
10 currentScreen: event.detail.locationName,
11 allScreens: this.screenNames.join(',')
12 }
13 }).then(() => {
14 //handle success
15 })
16}See Also