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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

How to update the correct value on another line

(0) ShareShare
ReportReport
Posted on by 55

Hi,

I have the following screen with Purchase header and Purchase line. In Short.. Commodity Receipt linked to a Commodity Contract

pastedimage1663139541275v2.png
Commodity Receipts Header
pastedimage1663139977293v6.png
Commodity Receipt Lines

pastedimage1663139757917v5.png
Commodity Contract Header


pastedimage1663141391581v10.png
Commodity Contract Lines



I'm trying to update the Valuationqtyrec 14 200 to Document No_: PCT00049 from the Commodity Receipt Lines, but it is updating Valuationqtyrec for Document: COMRCT00059

pastedimage1663143278152v1.png

pastedimage1663143424347v3.png



Are there a way to update the correct valuation Qty from the Receipts lines?

Thanks
Jaco

I have the same question (0)
  • JacoBosch Profile Picture
    55 on at

     I can't seem to find the issue why the first line gets updated

  • Suggested answer
    IB-29041624-0 Profile Picture
    1,187 Moderator on at

    Where do you set the value for the Document no. Document Type an Line No. that you use in your get statement?

    The problem must be that those variables does not hold the correct values when you execute your get statment.

    I think you need to share more of your code here.

  • JacoBosch Profile Picture
    55 on at

    Apologies. Edited the question. I'm getting the correct value, but the incorrect line is updated

  • JacoBosch Profile Picture
    55 on at

    I've created button to get the value and to update the line, but only the first line is updated

    pageextension 50105 ContactL extends "Commodity Receipt Subform"

    {

       actions

       {

           addfirst("F&unctions")

           {

               action("Calculate Qty Remaining")

               {

                   Promoted = true;

                   PromotedCategory = Process;

                   ApplicationArea = All;

                   trigger OnAction()

                   begin

                       GetValuationQtyCalcQtyRemain();

                   end;

               }

           }

       }

       procedure GetValuationQtyCalcQtyRemain()

       var

           line: Record "Purchase Line";

       begin

           if (line.Get("Document Type", "Document No.", "Line No.")) then begin

               line.CalcSums("Valuation Quantity");

               Valuationqtyrec := Rec."Valuation Quantity";

               Rec.Modify();

           end;

       end;

    }

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,086 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,290 Super User 2026 Season 1

#3
AndrewThomas81 Profile Picture

AndrewThomas81 1,218

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans