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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Business Central forum

Hyperlink Handler

(0) ShareShare
ReportReport
Posted on by 525

Hi 
I'm trying to test a custom action in my test app. When action is invoked, it should open a url. In the test function, I have created a HyperlinkHandler but it is not working. When i run the test case in test tool, it says 'Unhandled UI: Hyperlink' . Any guesses about what's missing here?

[Test]
    [HandlerFunctions('HyperlinkHandler')]
    procedure TestLookupDocument()
    var
        VendorLedgerEntry: TestPage "Vendor Ledger Entries";
        BfSetup: Record "MDCBF Setup";
        TestDataMgt: Codeunit "MDCBF Test Data Management";

    begin
        //[Scenario] If Lookup Document action is invoked, it opens that document in Batchflow online Dashboard 
        //[Given] vendor Ledger entries Page is open, serial no. in setup is not blank
        TestDataMgt.InitializeSetup();
        TestDataMgt.SetupMockStripeData();
        Commit();
        VendorLedgerEntry.OpenView();
        Assert.IsTrue(VendorLedgerEntry."Lookup Document".Visible(), 'Action LookupDocuments is Visible');
        Assert.IsTrue(VendorLedgerEntry."Lookup Document".Enabled(), 'Action LookupDocuments is enabled');
        VendorLedgerEntry."Lookup Document".Invoke();
    end;

Below is the handler function: 

 [HyperlinkHandler]
    procedure HyperLinkHandler(Message: Text[1024]);
    var
        Pos: Integer;
    begin
        Pos := StrPos(Message, 'dashboard.bfonline.dk/.../login');
        Assert.IsTrue(Pos = 1, 'Hyperlink is correct');
    end;



Categories:
  • Verified answer
    Mohsin Abbas Profile Picture
    525 on at

    Hi guys, I just found out with the help of a friend that it was a silly mistake.

    The handler name specified with the test procedure is  [HandlerFunctions('HyperlinkHandler')] while the handler function name is 'HyperLinkHandler' .  Looks like AL becomes case-sensitive when it comes to naming UI Handlers :)

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Business Central

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans