How to do it...

  1. In Visual Studio Code, open your AL project.
  2. In Explorer, create a new file named Television Role Center.al, and in the Editor tab, start by creating a new Role Center page:
page 50103 "Television Role Center"
{
PageType = RoleCenter;
}
  1. Add the layout section to define what parts will appear in the role center. You can use any existing page part in the system or build new ones.

In this example, we'll use a new activities part that was created specifically for this role center, as well as a couple of system parts that are common in most role centers:

layout
{
area(RoleCenter)
{
part(Activities; "Television RC Activities")
{
ApplicationArea = All;
}
part("Report Inbox Part"; "Report Inbox Part")
{
ApplicationArea = All;
}
part("Power BI Report Spinner Part"; "Power BI
Report Spinner Part")
{
ApplicationArea = All;
}
}
}
  1. After the layout section, we'll add a new section named actions, so we can define what actions are in the role center:
actions
{
}
  1. The first set of actions we'll define are some lists that we want in the navigation bar. We do that by adding the following code within the actions section:
area(Embedding)
{
action("Television Show List")
{
RunObject = page "Television Show List";
Caption = 'Television Shows';
ApplicationArea = All;
}
action("Customer List")
{
RunObject = page "Customer List";
Caption = 'Customers';
ApplicationArea = All;
}
}
  1. Next, we will define a couple of navigation menus with a link under each. This is done by adding the following code after the area(Embedding) section:
area(Processing)
{
group(New)
{
action(NewCustomer)
{
RunPageMode = Create;
Caption = 'Customer';
RunObject = page "Customer Card";
Image = Customer;
ApplicationArea = All;
}
}
group(Reports)
{
action("Television Show Report")
{
Caption = 'Television Shows';
Image = Report;
RunObject = report "Television Shows Report";
ApplicationArea = All;
}
}
}
  1. Now that we've created our role center, we need a profile that is associated with it. In Visual Studio Code's Explorer pane, create a new file named Television Profile.al and in the Editor tab, add the following code:
profile "Television Profile" 
{
Description = 'Television Profile';
RoleCenter = "Television Role Center";
}
You can use the tprofile snippet to create a new profile object.
  1. Now, it's time to try out our new role center! Follow these steps:
    1. Press F5 to build and publish our application.
    2. In Business Central, click the  icon at the top-right of the window and select My Settings.
    3. Click the assist edit (...) icon next to the Role Center field to open the list of role centers.
    4. Find and select the Television Role entry and click Ok.
    5. Click Ok to close the Settings page.

At this point, your browser will reload and you will now be looking at the new role center you created! Yeah I know, it's not exactly an impressive role center, and it makes absolutely no sense for an ERP system, but who cares? You're learning, right?

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset