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

Try Get Filed "Buy-from Contact" From Screen to appear in other Screen

(0) ShareShare
ReportReport
Posted on by 2
HI
I Try Get /Buy-from Contact/ : 
Source Screen : Purchase Quotes
Destination Screen : Requests to Approve
The subscriber field on the two screens is /Document No./
I am currently trying to use Unit code to solve this            problem, Does this solution work?
 
Is this code correct 
the next
?
=========================================================================================
codeunit 51241 DataPassing
{

    var
        BuyFromContact: Text[100];
    procedure PassBuyFromContact()
    var
        SourceRec: Record /Purchase Header/;
        TargetRec: Record /Approval Entry/;
    begin
        CLEAR(SourceRec);
        CLEAR(TargetRec);
        SourceRec.SETRANGE(/No./, '1502');
        //SourceRec.SETFILTER(/No./, Rec./No./);
        if SourceRec.FINDFIRST THEN begin
            BuyFromContact := SourceRec./Buy-from Contact/;
            TargetRec.INIT;
            TargetRec.Contact := BuyFromContact;
            TargetRec.INSERT;
        end
        else begin
        end;
    end;
}
=========================================================================================
What do I write here       for the codeunit to work ????????????????????
pageextension 51244 PageExtension50099 extends /Requests to Approve/
{
    layout
    {
        addbefore(/Details/)
        {
            field(/Buy-from Contact Copy/; Contact)
            {
                ApplicationArea = All;
                Editable = false;
            }
        }
    }
}
 
 
 
 
I ask for help from those with experience  (
Note: The post does not write a double quote, unfortunately, and puts (/) in its place.
)
 
 
  • Suggested answer
    Rami Mazrawi Profile Picture
    2 on at
    Try Get Filed "Buy-from Contact" From Screen to appear in other Screen
    Thank you very much...
     
  • Verified answer
    YUN ZHU Profile Picture
    79,097 Super User 2025 Season 1 on at
    Try Get Filed "Buy-from Contact" From Screen to appear in other Screen
    Hi, I also recommend you use FlowField, which requires no coding.
    If you want to fill in this value when inserting, it is not correct.
    The codeunit you wrote will not run. You need to find the right event, you can try the following.
     
    Hope this can give you some hints as well.
    Thanks.
    ZHU
  • Verified answer
    Hein Kruger Profile Picture
    511 on at
    Try Get Filed "Buy-from Contact" From Screen to appear in other Screen
    Hi, 
    You already have the document No. & the table ID on the "Request to Approve" Table. 
    You can use a flow field to get the Buy-from Contact No. 

    See the link attached of an example  of how to use flow fields from Yun Zhu. 
    https://yzhums.com/5802/
     
     

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,209 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,923 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans