Assisted Setup – Part 2: Basics
In the first article, I tried to show you why you need the assisted setup – and if you are here it means you want to create an assisted setup for your extensions (at least I hope so). That is great! If you do not know how to start this post is just for you. In the next articles, I will use this as a base for more complex examples.
Assisted Setup – don’t start from scratch
I really like that assisted setup is part of the System App. That means the documentation for it you can find on GitHub here:
https://github.com/microsoft/ALAppExtensions/tree/master/Modules/System/Assisted%20Setup
Another useful thing could be Waldo’s extension where you can find a snippet for the whole codeunit for the assisted setup. The snippet has more than we need at this moment, but it is a good starting point.
Adding groups
As you may notice the assisted setup is grouped by functionality, for example, Set up your company or Get ready for business.
To add a new group, you need to create the enum Assisted Setup Group extension.
Since I also want that in my assisted setup there will be a video link, I will add additional enum extension (this time for the Video Category enum). It allows me to put videos in a specific group which user could filter.
Adding a row to Assisted Setup
In this example I will not show how to develop wizard/guides – I want to keep it simple (for now). So, at this point, you will see only how to register the page in the assisted setup and how to mark it as completed.
For that, I need a table and page with setup. I will not paste here the code for it, but you can find it on GitHub. I called them the MNB Extension Setup table and the MNB Extension Setup page.
To add the record to assisted setup I added event subscriber to the OnRegister event in codeunit Assisted Setup. Then I run the Add method in the same codeunit.
As a parameter for this function, I needed to specify for which Extension is the assisted setup belongs to. To get App Id I used Waldo’s function
Effect of this simple code you can check below.
Adding the video
To add a video to the assisted setup I needed to specify the URL for the video. Remember only that when you want to play video for example from YouTube you need to put the link which says that video is embedded. Otherwise, the video will not work – and there is no information about why it is not working.
If you add the video from assisted setup it automatically will be shown in the Product Videos. You do not need to add it to other functions.
Adding the Read button
To add the Read button in the assisted setup you need to specify one of the parameters in the function Add. If you will leave it blank then the button will not be shown.
Set setup as complete
The last thing which is needed in the codeunit is to check if the setup was already done by the user or not. For that, I used function UpdateStatus (from Waldo’s snippet). In it, I could specify that setup is completed if the record exists. I added more complex checking for example if setup exists and one of the fields has value.
I run this function at the end of the OnRegister event and (which is even more important) on closing the page Extension Setup.
Now when a user will try to run the setup one more time from Assisted Setup I will get a notification that it was already completed.
Next steps and repository
In the next article, I will try to guide you on how to create a guide.
All the examples you can find on my GitHub repository here: https://github.com/mynavblog/Examples/tree/master/AssistedSetupBasics
Krzysztof, great series. Question: how can you set an assisted setup back to not completed?
That is good question 🙂 Will check and will write in next part.