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 :
Small and medium business | Business Central, N...
Answered

How to call action from within the OnValidate trigger (AL Development)

(0) ShareShare
ReportReport
Posted on by 397 User Group Leader

Hello, don't know if I am right here but anyway:

I don't get it how to call an action/procedure from  withhin the OnValidate() function inside a field - to simple to get it.

The exercise is to:

  1. Call the procedure GetSuggestion from within the OnValidate trigger.

Code blow:

page 50112 StatmentsCard
{
    PageType = Card;
    ApplicationArea = All;
    UsageCategory = Documents;
    Caption = 'Statments Card';

    layout
    {
        area(Content)
        {
            group(Eingabe)
            {
                Caption = 'Input';
                Description = 'Input';
                field(Schwierigkeitsgrad; Difficulty) //tpagefield
                {
                    ApplicationArea = All;
                    Description = 'Schwierigkeitsgrad';

                    trigger OnValidate()
                    begin

                    end;

                }
            }
            group(Ausgabe)
            {
                caption = 'Output';
                field(Vorschlag; Suggestion)
                {
                    ApplicationArea = All;
                    Description = 'Vorschlag';
                    Editable = false;
                }
                field(Ebene; Level)
                {
                    ApplicationArea = All;
                    Description = 'Ebene';
                    Editable = false;
                }
            }
        }
    }

    actions
    {
        area(Processing)
        {
            action(GetSuggestion)
            {
                ApplicationArea = All;

                trigger OnAction()
                begin
                    Level := '';
                    Suggestion := '';

                    case Difficulty of
                        1 .. 5:
                            begin
                                Level := 'Beginner';
                                Suggestion := 'Take e-Learning or remote training';
                            end;
                        6 .. 8:
                            begin
                                Level := 'Intermediate';
                                Suggestion := 'Attend instructor-Led';
                            end;
                        9 .. 10:
                            begin
                                Level := 'Advanced';
                                Suggestion := 'Attend instructor-Led and self study';
                            end;
                    end;
                end;
            }
        }
    }

    var
        Level: Text[30];
        Suggestion: Text[80];
        Difficulty: Integer;
}

Thank you, 

Tom

I have the same question (0)
  • Verified answer
    Rbansode Profile Picture
    5 on at

    Hi,

    You can not call the GetSuggestion action from the OnValidate trigger of the field.

    You can however call the same logic that you are calling in the "GetSuggestion" action from the OnValidate trigger.

    Ideally by creating a common procedure.

    Please verify my answer if you found it helpful. Thank you!

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,005 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,148 Super User 2026 Season 1

#3
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 557 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans