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';}
 
 
 
 
 
 
 
  • Control Add-in Only executing once
    .
  • David Tailor Profile Picture
    David Tailor 769 on at
    Control Add-in Only executing once
    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
  • jack Profile Picture
    jack 13 on at
    Control Add-in Only executing once
    (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';
    }
     
     
     
     

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,494 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans