Skip to content

Question: How is ModalPageHandler intended to be used? #2668

@hemisphera

Description

@hemisphera

What do I need to do?

I need to write a handler that intercepts the Gen. Jnl. Template lookup when opening a General Journal with multiple templates of the same type defined, then select a specific one and return with LookupOK.

What have I tried?
I have the following method that is declared as [ModalPageHandler]:

    [ModalPageHandler]
    procedure SelectTemplateHandler(var zhePage: TestPage "General Journal Template List")
    var
        t : Variant;
    begin
        zhePage.GoToKey('GEN-SIM');
        t := zhePage.OK();
    end;
  1. I only deducted, that OK could be the method I am looking for. But OK is not documented anywhere. Neither is Cancel (a method of the same object). It returns a DataType called TestAction, which is unknown to AL (and C/AL aswell btw.). What do I have to do with this?
  2. When I do not catch the return value of OK, the compiler errors out saying I have to catch the return value.
  3. The only way I got it compiling is by trapping the result inside a Variant (as shown above). This way the extension compiles, but the test fails with no error message and Result = Failed.
  4. I have also tried the alternative signature of using NameOfValriable: Page; var Response: Action. But in this case I do not have a TestPage, but only a Page. And then I do not have GoToKey method that allows me to select a specific record.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugProduct bugships-in-future-updateThe issue is fixed in our 'master' branch and will ship in the next PREVIEW release

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions