Exercise - Add the Customer Rewards Wizard page to the assisted setup
Scenario
The Base Application adds several assisted setup guides by subscribing to the OnRegister event. In the following example, the Customer Rewards Wizard page is added to assisted setup through the API that is exposed for the module. The English (United States) translation for the name is also added.
Add the Customer Rewards Wizard page to the assisted setup
To add the Customer Rewards Wizard page to the assisted setup, follow these steps:
Create a new file.
To create a new page in your extension, first create a new file. Select the New File button in the side bar of Visual Studio Code.
Make sure that the filename ends with .al. In this example, you might want to use the name CustRewardsAssistedSetup.Codeunit.al.
Add the code to the page. You can copy the following code and paste it in the CustRewardsAssistedSetup.Codeunit.al file.
codeunit 50102 "Cust Rewards Assisted Setup"
{
trigger OnRun()
begin
end;
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Guided Experience", 'OnRegisterAssistedSetup', '', false, false)]
local procedure AddExtensionAssistedSetup_OnRegisterAssistedSetup();
var
GuidedExperience: Codeunit "Guided Experience";
CurrentGlobalLanguage: Integer;
myAppInfo: ModuleInfo;
WizardTxt: Label 'Customer Rewards assisted setup guide';
GuidedExperienceType : Enum "Guided Experience Type";
VideoCategory : Enum "Video Category";
begin
NavApp.GetCurrentModuleInfo(myAppInfo);
CurrentGlobalLanguage := GlobalLanguage();
GuidedExperience.InsertAssistedSetup(WizardTxt, WizardTxt, WizardTxt,5,ObjectType::Page,page::"Customer Rewards Wizard","Assisted Setup Group"::Extensions,'',VideoCategory::Uncategorized,'');
GLOBALLANGUAGE(1033);
GuidedExperience.AddTranslationForSetupObjectTitle(GuidedExperienceType::"Assisted Setup", ObjectType::Page,Page::"Customer Rewards Wizard", CurrentGlobalLanguage, WizardTxt);
end;
}