Skip to main content

Notifications

Small and medium business | Business Central, N...
Answered

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

Posted on by 65
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.
)
 
 
Categories:
  • Suggested answer
    Rami Mazrawi Profile Picture
    Rami Mazrawi 65 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
    YUN ZHU 73,565 Super User 2024 Season 2 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
    Hein Kruger 501 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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans