Skip to main content
Dynamics 365 Community / Forums / Finance forum / Unable to get local bu...
Finance forum
Suggested answer

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

editSubscribe (0) ShareShare
ReportReport
Posted on by 127
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
 
Attachments
  • Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,430 Super User 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 2,829 Super User 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 127 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,430 Super User 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 127 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 2,829 Super User 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 222,689 Super User 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 127 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 222,689 Super User 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.

Helpful resources

Quick Links

New Blog Features Released!

Check out the new community blog features for viewers and authors…

Setting Up Knowledge Sources for Copilot…

Look at how configuring a comprehensive knowledge base is crucial…

Demystifying Copilot with Georg Glantschnig…

Industry experts answer burning questions directly from our amazing Community…

Leaderboard

#1
Andre Arnaud de Calavon Profile Picture

Andre Arnaud de Cal... 283,130 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 222,689 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,138

Featured topics

Product updates

Dynamics 365 release plans