Saturday, January 25, 2020

Microsoft Business Central - Substituting Reports

Hello Friends,

Microsoft Business Central Provide new Substituting Report event to replace the standard system report with custom report.

It is possible to substitute reports from the base application with custom reports. This can be done by subscribing to the OnAfterSubstituteReport event published by Codeunit 44 – ReportManagement.
The following code illustrates how to subscribe a method to the OnAfterSubstituteReport event. This method replaces the report specified by the ReportId with the one given by the NewReportId parameter. In this example the "Customer - List" report will be substituted for "My New Customer - List".

codeunit 50100 "Substitute Report" { [EventSubscriber(ObjectType::Codeunit, Codeunit::ReportManagement, 'OnAfterSubstituteReport',
'', false, false)] local procedure OnAfterSubstituteReport(ReportId: Integer; var NewReportId: Integer) begin if ReportId = Report::"Customer - List" then NewReportId := Report::"My New Customer - List"; end; }

When the OnAfterSubstituteReport event is raised, the event subscriber method is called and the replacement takes place.
 Note
The event is called OnAfterSubstituteReport to match the pattern followed by other events in the ReportManagement codeunit, but the subscriber will be invoked before the substitution takes place.
The OnAfterSubstituteReport event is raised when:
  1. The user activates a page action that runs the report to be substituted, that is, an action that has the RunObject Property set to the report.
  2. The report is invoked from the Tell Me window.
  3. The report is called by one of the following static methods:
For more information about raising events, see Raising Events.

Good practices

  • Consider using the same caption for both reports, given by the Caption Property. Consequently, any links and action captions that lead to the report will match the report itself. This is also relevant for bookmarks linked to a report, since they maintain the caption of the original report, even if it has been substituted for one with another caption.
  • Consider hiding the original report from the TellMe window if it is no longer valuable to all users. You can do this by setting the original report to UsageCategory Property to None.
  • Consider enhancing the code of the subscriber method to check if the report has already been replaced with another extension. This is done by comparing the ReportId and NewReportId parameters before making the change, such that if the value of the NewReportId parameter is different from the value of the ReportId parameter and different from -1, it means that the report has already been substituted for another subscriber of the OnAfterSubstituteReport event.
 Important
Make sure that if a report is called on code, you use a compatible report to replace it to avoid run time errors.

Source of Link-



Sunday, November 17, 2019

Add New Group on Role Center page by Extended Objects in Business Central

Hello Friends,

We can extend the role center page in business central to add new group on role center page.


pageextension 52515 BusinessManagerRoleCenterEx extends "Business Manager Role Center"
{
    // version NAVW113.00,NAVNA13.00

    actions
    {
        addafter(SetupAndExtensions)
        {
            group("**** House")
            {
                Caption = '**** House';
                Image = Journals;
                ToolTip = 'Collect and make payments, prepare statements, and reconcile bank accounts.';
                action("Item Tagging List")
                {
                    ApplicationArea = All;
                    Image = List;
                    Promoted = true;
                    PromotedCategory = Process;
                    RunObject = Page 52508;
                }
                action("Staging Invoice List")
                {
                    ApplicationArea = All;
                    Image = List;
                    Promoted = true;
                    PromotedCategory = Process;
                    RunObject = Page 52511;
                    RunPageView = SORTING ("Applet Order No.")
                                  ORDER(Ascending);
                }

                action("****house Integration Setup")
                {
                    ApplicationArea = All;
                    Image = Administration;
                    Promoted = true;
                    PromotedCategory = Process;
                    RunObject = Page 52501;
                }

                action("Item List WS")
                {
                    ApplicationArea = All;
                    Image = List;
                    Promoted = true;
                    PromotedCategory = Process;
                    RunObject = Page 52504;
                    RunPageView = sorting ("No.")
                                    order(ascending);
                }

                action("Department")
                {
                    ApplicationArea = All;
                    Image = List;
                    Promoted = true;
                    PromotedCategory = Process;
                    RunObject = Page 52505;
                    RunPageView = sorting ("Attribute ID", ID)
                                    order(ascending);
                }

                action("Item Tagging Process")
                {
                    ApplicationArea = All;
                    Image = "Report";
                    Promoted = true;
                    PromotedCategory = Process;
                    RunObject = Report 52503;
                }
                action("Staging Invoice Process")
                {
                    ApplicationArea = All;
                    Image = "Report";
                    Promoted = true;
                    PromotedCategory = Process;
                    RunObject = Report 52502;
                }
            }
        }
    }
}


New action group look like




















Thank you reading.

Keep Sharing...Keep Growing...

The length of the source exceeds the size of the destination buffer

Hello Friends,

While export the object in fob files system give error as

The length of the source exceeds the size of the destination buffer



















Solution:
This error come while you define 250 Char value in version list
To solve this error Just reduce version list upto 245 Char (remove 5 char only)

Old Value - NAVW19.00.00.51418,NAVIN9.00.00.51418,2868,2783,3214,T3485,T4137,T4158,T5550,T6288,T7542,T7585,T8452,Ecommerce,T8597,T9462,T09535,T09975,T10219,T10335,T10023,T10284,T11205,T11108,T11535,T12441,T12708,T12645,T12817,T13348,T13051,T13625,T13719,T14045

New Value-
NAVW19.00.00.51418,NAVIN9.00.00.51418,2868,2783,3214,3485,4137,4158,5550,6288,7542,T7585,T8452,Ecommerce,T8597,T9462,T09535,T09975,T10219,T10335,T10023,T10284,T11205,T11108,T11535,T12441,T12708,T12645,T12817,T13348,T13051,T13625,T13719,T14045

I hope this help someone

Thank you for reading,

Keep Sharing...Keep Growing...

Key Expiration issue on NAV Service Start (using SQL Authentication)

Hello Friends,

When we use the SQL Authentication in NAV Service.
After few days NAV Service will suddenly stop and give key expiration issue on startup.

Here are steps to solve the key expiration issue.


  1. Login NAV Application Server and Enable view Hidden File Option
  2. Goto following directory of Key File
C:\ProgramData\Microsoft\Microsoft Dynamics NAV\90\Server\Keys
















Delete/Rename the existing key file of service

Goto NAV Service Administrator Tool and enter the password again in NAV Service
It will automatic create new key file



















Hope this help to someone

Thanks for reading.

Keep Sharing....Keep Growing....

Variable and Fields Size Increased in Business Central

Hello Friends,

From Business Central April 2019 release,
The maximum allowed characters for text and code type table fields, variables, and text constants has expanded. The new limits are as follows:
Table fieldsCode maximum specified length: 2048
Text maximum specified length: 2048
VariablesCode maximum specified length: 2048
Text maximum specified length: 2048
Text constantsText constant maximum length: 2048
 Note
Text variables still have an unlimited length if no length is specified. This is actually controlled by Int32.MaxValue.

QR/Barcode Scanning Mobile App using PowerApps integrate with Business Central & Dynamics NAV

Hello Friends,

As Mobile App development becomes very easy using PowerApps,

I have Created an App that will scan the Barcodes and QR Codes from Mobile App and Stores the scanned data into Business Central/Dynamics NAV

You can also develop this within minutes.

Just go through following steps.

Go to https://make.powerapps.com and login with your Microsoft account.

Create one Blank Canvas App.


























On the screen, just insert Barcode Scanner Control as follows.















Now insert the Gallery control to display the Scanned Data.















Now write a piece of code on “onScan” trigger of Scanner to collect the Scanned data into PowerApps Collection. “Collect(ScannedData,BarcodeScanner1.Value)”















Now Set the “Data source” Property of Gallery Control with “ScannedData”














Now Create one Microsoft flow to store these data into Business Central or any other data sources.
Go to the MS flow portal(http://flow.microsoft.com)

Create a new flow as follows.







Choose the PowerApps and set the Name as: “Insert Data” and click on create.














Meanwhile create one table(with Two fields “Entry No.”(Auto Inc.) and Scanned Value(Text[250])”) and page into Business Central to store scanned data into it; Publish the Page into Web service, as we are going to use OData URL to push Data into Business Central; and ready with OData URL along with User Name and Web Service Access Key; we’ll be using this into Flow creation.

Let’s go back to the MS Flow.


Click on New Step to and search for the “Initialize Variable” action.























Rename the Action name as “JsonFromPowerApps”; put the same name into Name Field; Type = String and Value = “Ask in PowesApps”.





















Add next Step and search for “Parse JSON”.













  • In Content Field select the “JsonFromPowerApps”. And put the JSON Schema as follows:
{
    "type": "array",
    "items": {
        "type": "object",
        "properties": {
            "Value": {
                "type": "string"
            }
        },
        "required": [
            "Value"
        ]
    }
}































Add next step to call Business central OData service to insert the Data into Table.














Set the Method = POST; URI = “Your OData URL of Business Central”
Body = { “Scanned_Value”: “Value of Parse JSON” } and set the authentication as “Basic” as follows.














Save the Flow and go back to the PowerApps.

Add one Button to this screen and set the Text = “Insert Data”.















Select the button and go to the Action > Flows as follows.
















Select and Add the Flow which we have created.



















Now on the “onSelect” trigger, write the piece of code to call the flow from PowerApps as follows.
Set(JsonData,JSON(ScannedData));InsertData.Run(JsonData);Clear(ScannedData)
















Now go to File menu and Save this app as “Barcode with BC”.














Its time to Test this App now.
Download the “PowerApps” from Google Play store or from Apple Store for iOS Devices.
Login with Microsoft Account in which we have created PowerApps Mobile App.

You will see the App “Barcode with BC” that we just have created.
























Open the App and you will notify with the Camera permission, tap on Allow on this.

























Now tap on Scan Button to start Code Scanning; you can see the scanned data into Gallery


























































After scanning multiple codes tap on “Insert Data” to store these data into Business Central Table (It will call MS Flow and Inserts the Data into BC).
You can see the data comes into Business central within milliseconds.













You can also share innovative thoughts to develop another App like this.

Thank you for reading.
If you have any query than write in comment box

Keep Sharing....Keep Growing....