Skip to main content

Notifications

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 

  • karthikeyani c Profile Picture
    190 on at
    RE: Regarding - FieldRef.value[(Any)] - method

    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

  • Suggested answer
    YUN ZHU Profile Picture
    83,305 Super User 2025 Season 1 on at
    RE: Regarding - FieldRef.value[(Any)] - method

    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

  • Suggested answer
    Nitin Verma Profile Picture
    21,548 Moderator on at
    RE: Regarding - FieldRef.value[(Any)] - method

    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.

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

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

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 1,200

#2
YUN ZHU Profile Picture

YUN ZHU 1,006 Super User 2025 Season 1

#3
Mansi Soni Profile Picture

Mansi Soni 836

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans