Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

Unable to get local buffer in class protected method in chain of command in X++

Posted on by 131
Existing class method:
 
 
 
 
Chain of command of above method:
 
Also I try to set in new buffer with this.localSalesInvoiceTmp, that is also showing error
 
  • Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,590 Super User 2024 Season 1 on at
    Unable to get local buffer in class protected method in chain of command in X++
    Do you still need solution for this issue? If not please check 'Does this answer your question' for those helpful answers.
  • MichaelZ Profile Picture
    MichaelZ 2 on at
    Unable to get local buffer in class protected method in chain of command in X++
    Deleting response as I didn't release this forum has newest posted at the top.

    What is the downside to extending useExistingReportData() and return false?  Wouldn't this properly force the system to regenerate the data in the tables?
  • Layan Jwei Profile Picture
    Layan Jwei 7,204 Super User 2024 Season 2 on at
    Unable to get local buffer in class protected method in chain of command in X++
    Hi Itlabnarmi,

    In one of the screenshots you showed us, in "ProcessReport" method, there is a method called createData(), does it get called?
    because inside this method, "insertInvoiceHeaderInformation()" gets called, which then calls insertIntoSalesInvoiceTmp() and this one calls the populate method


    Thanks,
    Layan Jweihan
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future
  • itlabnarmi_ivoruk Profile Picture
    itlabnarmi_ivoruk 131 on at
    Unable to get local buffer in class protected method in chain of command in X++
    Hi Layan Jwei  you are absolutely right, in the beginning of report development I exactly did that extend  "populateSalesInvoiceHeaderFooterTmp" and "populateSalesInvoiceTmp" methods and set values in extension fields but when I try to debug my extension and standard populate method they are not triggering at all (surprisingly). I also check all reference these method were not using at all (don't why). I already mentioned in my comments below how data are filling in these temp tables.
     
  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,590 Super User 2024 Season 1 on at
    Unable to get local buffer in class protected method in chain of command in X++
    You can do an oninserted event handler for those temp tables which will solve your purpose. 
  • itlabnarmi_ivoruk Profile Picture
    itlabnarmi_ivoruk 131 on at
    Unable to get local buffer in class protected method in chain of command in X++
    Hi Martin,
     
    I checked that by attaching debugger on SalesInvoiceDPBase.processReport() where the debugger hit and from there it foes into this.useExistingReportData() method which is in SalesInvoiceDP class.
     
     
     
     
    In the SalesInvoiceDP class's useExistingReportData() method data are fetching in localSalesInvoiceTmp and localSalesInvoiceHeaderFooterTmp.
     
     
     
    Is there any possibility to update these local buffer.
     
     
     
    I also tried by writing COC of SalesInvoiceDPBase.processReport() and trying to get table buffer salesInvoiceTmp and salesInvoiceHeaderFooterTmp (Not local buffer but the table which return from DP class). Unfortunately I am unable to get these buffer too. Please suggest any best possible solution !
     
     
  • Suggested answer
    Layan Jwei Profile Picture
    Layan Jwei 7,204 Super User 2024 Season 2 on at
    Unable to get local buffer in class protected method in chain of command in X++
    Hi Itlabnamri,

    if you added fields to "SalesInvoiceTmp" and "SalesInvoiceHeaderFooterTmp".  Then the correct methods to fill those fields are "populateSalesInvoiceHeaderFooterTmp" and "populateSalesInvoiceTmp"

    Thanks,
    Layan Jweihan
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future
  • Martin Dráb Profile Picture
    Martin Dráb 229,275 Most Valuable Professional on at
    Unable to get local buffer in class protected method in chain of command in X++
    useExistingReportData() returns true, and therefore the data creation is skipped, if the data was already created for the same transaction. I suspect it's not really the case (that you failed to stop in those methods in debugger may mean that you didn't configure debugging correctly), but even if it is, you can't use that, because you want to intitialize the data and not using old data without your fields being initialized.
     
    First of all, put a breakpoint to SalesInvoiceDPBase.processReport() and check what happens there. If your breakpoint is ignored, enable debugging of Application Suite model (Dynamics 365 > Options > Debugging).
  • itlabnarmi_ivoruk Profile Picture
    itlabnarmi_ivoruk 131 on at
    Unable to get local buffer in class protected method in chain of command in X++
    Thanks Martin Dráb  for you quick response.
     
     
    My requirement is just to add new design in customer invoice report (SalesInvoice).
     
     
    and successfully added and run new design, now I want to add some addition field in report temp tables behind below data sources and added my additional fields.
     
     
     
    So to populate those additional fields I write COC of SalesInvoiceDP's method populateSalesInvoceTmp() and populateSalesInvoiceHeaderFooterTmp() but unfortunately  these both method were not triggering after attaching debugger. So I debugged code and find that I found that  from SalesInvoiceDPBase class it go into useExistingReportData() method.
     
     
     
    In useExistingReportData() method it is filling temp table so I write COC of that class and I am unable to get buffer.
     
     
    UseExistingReportData Method: 
     
     
     
     
    My Requirement is just to add some additional fields in both above mentioned tables and to add on my new report design.
     
     
     
     
  • Martin Dráb Profile Picture
    Martin Dráb 229,275 Most Valuable Professional on at
    Unable to get local buffer in class protected method in chain of command in X++
    That's the expected behavior. These are methods declared locally in useExistingReportData() and can't be accessed from outside.
     
    Your code does nothing useful; what you're trying select for update are table buffers that don't exist anymore; they ceased to exist at the end of useExistingReportData() (next useExistingReportData() in your extension).
     
    If you explain your business problem to us, we might be able to suggest a solution. So far, all we can say is that your code is wrong, but it doesn't tell us anything about your intentions.

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

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,900 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,275 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans