web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Unanswered

Control Add-in Only executing once

(1) ShareShare
ReportReport
Posted on by 13
Hello Community,
 
I created a control add-in which increases the font size on a custom page (image at bottom). The issue I am having is it only works one time and the next time I open the page the font returns to the base font. I am unsure how to alter my code so the javascript runs each time I open it. Let me know if you can offer some assistance. Source below. 
 
(controladdin)
controladdin JavacriptAccess{    Scripts = 'script.js';    StartupScript = 'startup.js';    MaximumHeight = 1;    MinimumHeight = 1;    MaximumWidth = 1;    MinimumWidth = 1;    RequestedHeight = 1;    RequestedWidth = 1;event ControlReady();procedure clickanything();}
 
(script.js)
function gettext(){    var FieldA= window.parent.document.getElementById('b9fee')        FieldA.style.setProperty('font-size','40px','important');}
 
(startup.js)
 
Microsoft.Dynamics.NAV.InvokeExtensibilityMethod('ControlReady',[]);
 
 
(Page)
 
page 62800 PoReportPage{    Caption = 'Purchasing Reports';    PageType = Card;    ApplicationArea = All;    Editable = false;    SaveValues = false;    UsageCategory = Administration;    layout    {        area(Content)        {            grid(grid1)            {                GridLayout = Columns;            }            field(A; 'Open PO Report')            {                ApplicationArea = All;                Editable = false;                ShowCaption = false;                Style = StrongAccent;                StyleExpr = true;                trigger OnDrillDown()                begin                    ;                    page.Run(62802);                end;            }            usercontrol(javascriptAccess;JavacriptAccess)            {                ApplicationArea = all;                trigger ControlReady()                begin                    CurrPage.javascriptAccess.gettext();                end;            }        }    }    var        A: Label 'Open PO Report';}
 
 
 
 
 
 
 
I have the same question (0)
  • jack Profile Picture
    13 on at
    (controladdin)
     
    controladdin JavacriptAccess
    {
        Scripts = 'script.js';
        StartupScript = 'startup.js';
        MaximumHeight = 1;
        MinimumHeight = 1;
        MaximumWidth = 1;
        MinimumWidth = 1;
        RequestedHeight = 1;
        RequestedWidth = 1;
    event ControlReady();
    procedure gettext();
    }
     
     
     
    page 62800 PoReportPage
    {
        Caption = 'Purchasing Reports';
        PageType = Card;
        ApplicationArea = All;
        Editable = false;
        SaveValues = false;
        UsageCategory = Administration;
        layout
        {
            area(Content)
            {
                grid(grid1)
                {
                    GridLayout = Columns;
                }
                field(A; 'Open PO Report')
                {
                    ApplicationArea = All;
                    Editable = false;
                    ShowCaption = false;
                    Style = StrongAccent;
                    StyleExpr = true;
                    trigger OnDrillDown()
                    begin
                        ;
                        page.Run(62802);
                    end;
                }
                usercontrol(javascriptAccess;JavacriptAccess)
                {
                    ApplicationArea = all;
                    trigger ControlReady()
                    begin
                        CurrPage.javascriptAccess.gettext();
                    end;
                }
            }
        }
        var
            A: Label 'Open PO Report';
    }
     
     
    (script.js)
     
    function gettext()
    {
        var FieldA= window.parent.document.getElementById('b9fee')
        
        FieldA.style.setProperty('font-size','40px','important');
    }
     
     
    (startup.js)
     
    Microsoft.Dynamics.NAV.InvokeExtensibilityMethod('ControlReady',[]);
     
     
    (page)
     
    page 62800 PoReportPage
    {
        Caption = 'Purchasing Reports';
        PageType = Card;
        ApplicationArea = All;
        Editable = false;
        SaveValues = false;
        UsageCategory = Administration;
        layout
        {
            area(Content)
            {
                grid(grid1)
                {
                    GridLayout = Columns;
                }
                field(A; 'Open PO Report')
                {
                    ApplicationArea = All;
                    Editable = false;
                    ShowCaption = false;
                    Style = StrongAccent;
                    StyleExpr = true;
                    trigger OnDrillDown()
                    begin
                        ;
                        page.Run(62802);
                    end;
                }
                usercontrol(javascriptAccess;JavacriptAccess)
                {
                    ApplicationArea = all;
                    trigger ControlReady()
                    begin
                        CurrPage.javascriptAccess.gettext();
                    end;
                }
            }
        }
        var
            A: Label 'Open PO Report';
    }
     
     
     
     
  • David Tailor Profile Picture
    822 on at
    Hi Jack,
     
    i write the same code you have posted. however i didn't have the same result: "Open PO Report" is not big even for first time.
    is there anything missing?
     
    Regards,
    David

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,577

#2
YUN ZHU Profile Picture

YUN ZHU 888 Super User 2025 Season 2

#3
Jainam M. Kothari Profile Picture

Jainam M. Kothari 778 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans