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 :
Business Central forum

A field in an extension doesn't refresh in a page

(0) ShareShare
ReportReport
Posted on by 40

Hi!

I was trying to add a new field by a table-extension in a standard table (called "Sales Line"), and then, I added this field in a page-extension of the page that I need it (called "Sales Invoice Subform") and that uses that table. 

Then, I created a codeunit that has a event subscriber to a method (called OnAfterCalculatePurchaseSubPageTotals) that executed the codeunit "Document Totals" in that page. In this subscriber, I assigned a value to my new field but it didn't show it, and when I test to assign a value to a standard field (for example, field "Line Amount") of that table, it shows the value without problems.

Do you know why could it be possible? Do you need to add something more to the new fields in a extension to allow to edit it? 

Categories:
  • Suggested answer
    Stefano Demiliani Profile Picture
    37,172 Most Valuable Professional on at

    No, you don't need nothing special to show a field value. I suggest to debug your code or check that page.

  • Krzysztof Bialowas Profile Picture
    500 on at

    Hi,


    Could you share your code? It might help to check the issue :)

    Best regards,

    Krzysztof

  • Judit Navarro Profile Picture
    40 on at

    Hi Krzysztof,

    Hre I'd made a small proyect as an example: https://we.tl/t-q9U8anSx6D

    At the end, when you execute it (for example, when you try to put some lines in a sales invoice), It shows the values that I gave to them in the event subscriber in the message windows, but not in the field of the page subform.

    Thank you for your help :)

  • Krzysztof Bialowas Profile Picture
    500 on at

    Hi Judit,

    I checked your code and how it is in standard and do not have good news. I think you cannot do it this way as you want. In fact on the standard page the control is not refering to Rec but to global variable TotalSalesLine. And you cannot get access to this variable from page extension. 

    2019_2D00_05_2D00_07-23_5F00_42_5F00_59_2D00_Window.png

    I think you need to find other way for your functionality. Maybe just calculate the totals and present it directly from subpage?

    Best regards,

    Krzysztof

  • Judit Navarro Profile Picture
    40 on at

    Hi Krzysztof,

    First at all, thank you for having patience and to try to help me with this question :) 

    When I analized the standard code, I saw what you said about the global variable TotalSalesLine. But the variable called TotalSalesLine2 is the one that give the value to the global variable TotalSalesLine, that's why in the event subscriber we try to change the field by using TotalSalesLine2. Using this one, we're able to change the value of the standard field, but I don't understand why this logic could not be applied to our new field of the extension.

  • Verified answer
    Krzysztof Bialowas Profile Picture
    500 on at

    Hi,

    But problem is not that you cannot assign value - this works and in TotalSalesLine2 and TotalSalesLine you in theory have the proper value in your field.

    But the issue is that you cannot show TotalSalesLine in Page Extension. It is global variable declared in Page Sales Invoice Subform. And you do not have access to it from your Page Extension.

    Best regards,

    Krzysztof

  • Judit Navarro Profile Picture
    40 on at

    Hi Krzysztof,

    Thank you for the explanation, now I understand it and I will try to find another solution.

    Have a nice day!

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Business Central

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans