Hello !
I'm learning AL development for 1 week, and I'm facing a pretty simple problem : how do I write a codeunit procedure that returns a value when it's called in pageExtension ? I've looked into the Microsoft documentation here : https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-al-methods But it only says that it can return a value, not how to do it.
What I'm trying to do is to call from a pageExtension a codeunit procedure returning a boolean value to switch the Visible property of a field to False. Here is my code :
pageextension 8007852 CustomerCardFieldCheckExt extends "Customer Card"
{
layout
{
modify(Address)
{
Visible = CustomerNameCheck2.AdresseVisible();
}
}
var
CustomerNameCheck2: Codeunit CustomerNameCheck2;
}
codeunit 8007853 CustomerNameCheck2
{
var
Pw_Visible: Boolean;
procedure AdresseVisible()
begin
Pw_Visible := false;
end;
}
PW_Visible is a global boolean variable, AdresseVisible() is a global procedure, so why does my pageExt shows the error "the expression must be of Boolean type" ? Is it because a procedure is not a boolean (even if it returns one) ? Or because my procedure doesn't return anything ?
Thank you for your help, and sorry if it is a very low level question.
Pierre