Advertisements

Creating a Wizard Page in AL for Business Central

In today’s post we will learn to create Wizards.

First Let us understand why we use wizards.

  • We can define wizard as series of user input screens or steps.
  • You can show/hide options for each step based on previous step selection that is relevant to complete any setup process.
  • User can navigate between steps with Next and Previous buttons.
  • In Web Client it shows buttons with specific styling.
  • We define Page with type NavigatePage.
  • Plays crucial part in Assisted Setup.

Without going into much theory let’s start creating a Wizard Page.

Step: 1 –

Create a New Page of type NavigatePage.

CI-1

Create *.al file in your VSCode Project, you can use tpage snippet.

Set the Unique available ID in your database and Extension.

Give meaningful name to your file.

Set the PageType property to NavigatePage.

Set SourceTable property to the base table in my case “Company Information”

Step: 2 –

Add a Group for each Step you wish for your Setup, in my case I am using 3 Step.

Create Global variable CurrentStep of type Integer, this will help making decision on which step you are currently and act accordingly.

CI-2

On each Group, Set the Visible property with an expression:

Visible – CurrentStep = 1;

And so on.

Step: 3 –

Create a sub-group inside the steps and set the suitable Caption.

Set InstructionalText to provide guidance

Add fields to the sub-group

CI-3

And similarly to other groups.

Step: 4 –

Add three actions to facilitate navigation.

For each action, set the InFooterBar property to true.

When this is used in combination of PageType NavigatePage, it will show action as navigation buttons.

CI-4

Step: 5 –

Create 3 global variables as Boolean, say ActionBackAllowed, ActionNextAllowed, ActionFinishAllowed

On each action, set the Enabled property to the appropriate global variable.

Set the Image property of your actions:

Back : PreviousRecord

Next : NextRecord

Finish : Approve

CI-5

Step: 6 –

Create function/procedure to SetControls, TakeStep and Set starting values in the OnOpenPage trigger.

CI-6

Step: 7 –

Now we will add OnAction trigger to the navigation actions.

CI-7

Step: 8 –

Now we will create 2 global record variables for Media Repository table and for the Media Resources table.

CI-8

Step: 9 –

Now add 2 new groups above Step 1 Group.

Add field to each group.

Set source expression to the Image field of the Media Resources variables.

Set ShowCaption property to false.

CI-9

You see error for TopBannerVisible let’s define a global variable of type Boolean.

Step: 10 –

Now we will Add a function to Load the top banner images.

Call this function from OnInit trigger.

CI-10

We are done with our base design of Wizard.

Now time to deploy and Test.

For testing purpose let’s hook it to some page and see the result.

Although it is not correct place but for testing purpose let’s add to our existing page created in earlier post “Loadout List” page and test the output.

CI-11

Added new action on “Loadout List” Page, just to check the output. I will come up with Assisted Setup in our next post and hook it there.

Now we will Build and Deploy the Extension and review what we created.

CI-12

Access your Loadout Point List Page from Sales Order Line and Run the Wizard.

Let’s run the same from the Web Client.

ci-13

ci-14

I will come up with linking this Wizard Page to Assisted Setup in our next post.

Advertisements

Database Replication – Part V

This post is in continuation to my earlier post. Please check if you missed.

Database Replication – Part I

Database Replication – Part II

Database Replication – Part III

Database Replication – Part IV

As committed in this post we will continue to cover practical approach, Next step from last post.

We will create a subscription using SQL Server Management Studio

To create the subscription

  • Connect to the Publisher in SQL Server Management Studio, expand the server node, and then expand the Replication folder.
  • In the Local Publications folder, right-click the Nav2018ItemTrans publication, and then click New Subscriptions.

DR-39

The New Subscription Wizard launches.

DR-40

  • On the Publication page, select Nav2018ItemTrans, and then click Next.

DR-41

  • On the Distribution Agent Location page, select Run all agents at the Distributor, and then click Next.

DR-42

  • On the Subscribers page, if the name of the Subscriber instance is not displayed, click Add Subscriber, click Add SQL Server Subscriber, enter the Subscriber instance name in the Connect to Server dialog box, and then click Connect.
  • On the Subscribers page, select the instance name of the Subscriber server, and select under Subscription Database.
  • On the New Database dialog box/Select from Drop Down List, enter Nav2018ReplDatabase in the Database name box, click OK, and then click Next.

DR-43

  • In the Distribution Agent Security dialog box, click the ellipsis (…) button, enter <Machine_Name>\repl_distribution in the Process account box, enter the password for this account, click OK.

DR-44

  • Click Next.

 

DR-45DR-46DR-47DR-48DR-49

  • Click Finish to accept the default values on the remaining pages and complete the wizard.

Setting database permissions at the Subscriber

  • Connect to the Subscriber in SQL Server Management Studio, expand Databases, Nav2018ReplDatabase, and Security, right-click Users, and then select New User.
  • On the General page, in the User type list, select Windows user.
  • Select the User name box and click the ellipsis (…) button, in the Enter the object name to select box type <Machine_Name>\repl_distribution, click Check Names, and then click OK.

DR-50

  • On the Membership page, in Database role membership area, select db_owner, and then click OK to create the user.

DR-51

When setting up SQL Server replication you might see an error message from the Transactional Replication Log Reader Agent which reads like the following.

Error messages:

  • The process could not execute ‘sp_replcmds’ on ”. (Source: MSSQL_REPL, Error number: MSSQL_REPL20011) Get help: http://help/MSSQL_REPL20011
  • Cannot execute as the database principal because the principal “dbo” does not exist, this type of principal cannot be impersonated, or you do not have permission. (Source: MSSQLServer, Error number: 15517) Get help: http://help/15517
  • The process could not execute ‘sp_replcmds’ on ”. (Source: MSSQL_REPL, Error number: MSSQL_REPL22037) Get help: http://help/MSSQL_REPL22037

Often this error message can come from the database not having a valid owner, or the SQL Server is not being able to correctly identify the owner of the database.

Often this is easiest to fix by changing the database owner by using the sp_changedbowner system stored procedure as shown below. The sa account is a reliable account to use to change the ownership of the database to.

USE PublishedDatabase

GO

EXEC sp_changedbowner ‘sa’

GO

Once the database ownership has been changed the log reader will probably start working right away. If it doesn’t quickly restarting the log reader should resolve the problem.

While this does require changes to the production database, there is no outage required to make these changes.

To view the synchronization status of the subscription

  • Connect to the Publisher in SQL Server Management Studio, expand the server node, and then expand the Replication folder.
  • In the Local Publications folder, expand the Nav2018ItemTrans publication, right-click the subscription in the Nav2018ReplDatabase database, and then click View Synchronization Status.

DR-52

The current synchronization status of the subscription is displayed.

DR-53

  • If the subscription is not visible under Nav2018ItemTrans, press F5 to refresh the list.

Validating the Subscription and Measuring Latency

We will use tracer tokens to verify that changes are being replicated to the Subscriber and to determine latency, the time it takes for a change made at the Publisher to appear to the Subscriber.

To insert a tracer token and view information on the token

  • Connect to the Publisher in SQL Server Management Studio, expand the server node, right-click the Replication folder, and then click Launch Replication Monitor.
  • Replication Monitor launches.
  • Expand a Publisher group in the left pane, expand the Publisher instance, and then click the Nav2018ItemTrans publication.
  • Click the Tracer Tokens tab.
  • Click Insert Tracer.
  • View elapsed time for the tracer token in the following columns: Publisher to Distributor, Distributor to Subscriber, Total Latency. A value of Pending indicates that the token has not reached a given point.

DR-54

This way we are done with Database Replication Setup.

Will come up with more topic soon.

 

Important

Most of the contents you find in this blog will be either inherited from MSDN or Navision Developer IT Pro Help. Some places images are also directly taken from these sites. Purpose is simple to try those stuffs and re-produce adding few things as per my understanding to make easy understanding for others and quick reference.

Here nothing under my own brand or authorship of the content. At any point of time we are just promoting Microsoft stuffs nothing personnel with same.

Hope stuffs used here will not violate any copyright agreement with them. In case by mistake or in-intestinally it happens and the Microsoft feels these should not be used Microsoft have full right to inform me about same and will be glad to take down any such content which may be violating the norms.

Purpose is to promote Navision and share with community.

FB Profile

Like FB Page

%d bloggers like this: