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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

How to use the RecordRef in Msg

(0) ShareShare
ReportReport
Posted on by 130

I want to get the salesline by using the RecordRef, I am trying in this way, Creating a action in Sales Orders page through the action I will call the salesline but I am not getting the sales line, can anyone help me, My code is 

  action(Action11)
            {
                Caption = 'Action 10';
                ApplicationArea = All;
                ToolTip = 'Describes the msg of salesline';
                Image = Action;
                trigger OnAction()
                var
                    RecRef: RecordRef;
                    FielRef: FieldRef;
                   
                begin
                    SalesLine.SetRange("Document Type", Rec."Document Type"::Order);
                    SalesLine.SetRange("Document No.", Rec."No.");
                    SalesLine.SetRange(Type, SalesLine.Type::Item);
                     recref.Open(37);
                    FielRef := RecRef.Field(SalesLine."Document Type");
                     FielRef.SetRange(SalesLine."Document Type", Rec."Document Type"::Order);
                     
                      if RecRef.FindFirst() then
                        Message(Text000Msg, SalesLine."Document Type");

                end;
I have the same question (0)
  • Suggested answer
    Amit Profile Picture
    2,563 on at

    Hi,

    action(Action11)
                {
                    Caption = 'Action 10';
                    ApplicationArea = All;
                    ToolTip = 'Describes the msg of salesline';
                    Image = Action;
                    trigger OnAction()
                    var
                        RecRef: RecordRef;
                        FielRef: FieldRef;
                       
                    begin
                        SalesLine.SetRange("Document Type", Rec."Document Type"::Order);
                        SalesLine.SetRange("Document No.", Rec."No.");
                        SalesLine.SetRange(Type, SalesLine.Type::Item);
                         recref.Open(37);
                        FielRef := RecRef.Field(SalesLine."Document Type");
                         FielRef.SetRange(SalesLine."Document Type", Rec."Document Type"::Order);
                         
                          if FielRef.FindFirst() then
                            Message(Text000Msg, SalesLine."Document Type");
    Regards
    Amit Sharma
  • Verified answer
    DAnny3211 Profile Picture
    11,423 Super User 2026 Season 1 on at

    Hi

    use this

     Caption = 'Action 10';

                   ApplicationArea = All;

                   ToolTip = 'Describes the msg of salesline';

                   Image = Action;

                   trigger OnAction()

                   var

                       RecRef: RecordRef;

                       FielRef: FieldRef;

                   begin

                       SalesLine.SetRange("Document Type", Rec."Document Type"::Order);

                       SalesLine.SetRange("Document No.", Rec."No.");

                       SalesLine.SetRange(Type, SalesLine.Type::Item);

                       if salesLine.findfirst then

                       Begin

                         recref.Open(37);

                         if recref.get(SalesLine.RECORDID) then

                           Message(Text000Msg, SalesLine."Document Type");

                         recref.close;

                       End;

                   end;

    regards DAniele

  • P V Sarath Profile Picture
    130 on at

    Thank you Incalza, for helping me.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 677 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 521 Super User 2026 Season 1

#3
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 306 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans