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

Notifications

Announcements

No record found.

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,557 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,397 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,226

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 2,047 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,257 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans