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...
Suggested Answer

Regarding - FieldRef.value[(Any)] - method

(0) ShareShare
ReportReport
Posted on by 190

Hi experts ,

Hope everyone is fine...

As many of you already know that FieldRef.value[(Any)] - method that it gets the value of the field and it does some modifications in that also

So my questions is ,

Is that be applicable/possible to apply it from one page to another ?

var
MyFieldRef: FieldRef;
CustomerRecref: RecordRef;
CustomerNo: Code;
Text000: Label 'Customer name has changed to %1.';
begin
CustomerNo := '50000';
CustomerRecref.Open(18);
MyFieldRef := CustomerRecref.Field(1);
if MyFieldRef.Active then begin
MyFieldRef.Value(CustomerNo);
MyFieldRef := CustomerRecref.Field(2);
MyFieldRef.Value('Contoso');
CustomerRecref.Modify;
Message(Text000, MyFieldRef.Value);
end;
end;

In the above example they done to change the name as 'Contoso' for the no 50000. Is that possible to made some changes from one page to another and can be called without specifying customer no whereelse it should be applicable to all the customer .

I hope my question is understandable 

please help me out of this ...

Thanks & Regards,

Karthikeyani C 

I have the same question (0)
  • Suggested answer
    Nitin Verma Profile Picture
    21,698 Moderator on at

    Hi,

    I dont under what you mean by One page to another, but you can use the same method to change the customer's field value without providing the hardcoded values, if you on page Customer card, you can use Onaftergetrecord trigger or instead you can use Batch Processing report of any table dataitem.

  • Suggested answer
    YUN ZHU Profile Picture
    95,329 Super User 2025 Season 2 on at

    Hi, Here is a special application that does not specify the field number, I hope it can give you some hints.

    https://yzhums.com/28900/

    pastedimage1663202912802v1.png

    Thanks.

    ZHU

  • karthikeyani c Profile Picture
    190 on at

    Receiving error ,

    The Production BOM Line does not exist. Identification fields and values: Production BOM No.='',Version Code='WHITEWHITE',Line No.='0'

    whereas this is my code

    action(Testing)

               {

                   Caption = 'Testing';

                   ApplicationArea = Suite;

                   ToolTip = 'Just for Testing the fieldref datatype';

                   trigger OnAction()

                   var

                       MyFieldRef: FieldRef;

                       ProdbomRecref: RecordRef;

                       ItemNo: Code[20];

                       SelectedRequisitionlines: Record "Requisition Line";

                       Text000: Label 'Variant name has changed to %1.';

                   begin

                       SelectedRequisitionlines.Reset();

                       CurrPage.SetSelectionFilter(SelectedRequisitionlines);

                       if SelectedRequisitionlines.FindSet() then

                           repeat

                               "Variant Code" += SelectedRequisitionlines."Variant Code";

                           until

                           SelectedRequisitionlines.Next() = 0;

                       ItemNo := rec."No.";

                       ProdbomRecref.Open(99000772);

                       MyFieldRef := ProdbomRecref.Field(2);

                       if MyFieldRef.Active then begin

                           MyFieldRef := ProdbomRecref.Field(3);

                           MyFieldRef.Value(Rec."Variant Code");

                           ProdbomRecref.Modify;

                           Message(Text000, MyFieldRef.Value);

                       end;

                   end;

               }

    And I'm Receiving runtime error on ProdbomRecref.Modify;---this line

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,229

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,867 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,153 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans