Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Answered

Sales invoice report logic change

(0) ShareShare
ReportReport
Posted on by 118
Hi all,
 
Well I have a simple requirement, where I have to change the logic for /SalesPrice/ on sales invoice report.
So I have made those changes in the dp class of the report. I created COC for /populateSalesInvoiceTmp/ method.
But when I run the report, the debugger doesn't hit these methods - populateSalesInvoiceTmp, insertIntoSalesInvoiceTmp.
Since the table is a regular one, I think they have put some conditions before populating it everytime.
 
Anyone can suggest how I can populate the field with my data? In Dev as well as in production.
I don't want to remove/bypass any standard condition or anything, but I want my code to get executed too.
 
Please suggest some solution here. I need to know what I am missing as soon as possible.
 
Thanks,
Bhagyashree Dave
  • Suggested answer
    Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    Sales invoice report logic change
    You can write your code in OnInserting event handler of SalesInvoiceTmp table or create extension class for that table and write code before next call in insert method.
     
    public void insert()
    {
       if (this.Qty > 0)
       {
          this.SalesPrice = this.LineAmount/this.Qty;
       }
       next insert();
    }
     
  • Bhagyashree Dave Profile Picture
    Bhagyashree Dave 118 on at
    Sales invoice report logic change
    Hi Martin and Mohit,
     
    I have moved this thread to the finance forum.
     
    So as per Mohit's suggestion I put debugger in insert of SalesInvoiceTmp. It is hitting.
    But in call stack, some useExistingReportData method is being executed. maybe that's why my code is not running, but I'm not sure.
     
    Here in the image is my code.
     
    Please suggest some solution.
     
  • Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    Sales invoice report logic change
    Hi, As Martin mentioned there can be issue with debugger. Can you create CoC or pre event handler on insert method of SalesInvoiceTmp table, add your code and check if debugger hits or if your values are populated correctly.
  • Martin Dráb Profile Picture
    Martin Dráb 230,853 Most Valuable Professional on at
    Sales invoice report logic change
    You're asking in the general D365, but your question seems to be specifically about one app: Finance and Operations. Please use the Finance forum next time. Unfortunately this new site doesn't (yet) allow moderators to move threads.
     
    The fact that "t, the debugger doesn't hit these methods" may mean that you have a problem with debugging, rather then the methods aren't called.
     
    Can you show us your class, please?

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,996 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,853 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans