Skip to main content

Notifications

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

Set default value "Never" to expire after column, when new financial report is generated.

(0) ShareShare
ReportReport
Posted on by 40

Hi everyone,

Good day to all, i am trying to set a default value in financial report version table the retentionExpirationDate field to max date which will show in the frontend form as "Never".
My code in financialreportVersion table extension:
pastedimage1681375306539v1.png
Class extension on FinancialReportingGenerateController. When generate button is clicked this class will be called.

pastedimage1681375349243v2.png

after generating the report I am able to see the expiration date being overwritten as "Never" but as i refresh the value changes back to 90 days instead of Never. I am unable to find what is overwriting the value. Would like to seek help on this issue. Thank you so much.

  • Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: Set default value "Never" to expire after column, when new financial report is generated.

    If it is displaying as Never then inserted correctly but some process must be updating it. Can you find reference on RetentionExpirationDate field and see if there is any other customization. Also put breakpoint on both methods in the below screenshot and check if it gets called when you click another financial report. (If it still refer to the original report where you changed to Never).

    pastedimage1681453628980v1.png

  • Benjamin long Profile Picture
    Benjamin long 40 on at
    RE: Set default value "Never" to expire after column, when new financial report is generated.

    Yes thank you so much, my Screenshot on the discussion is the COC that i have done on execute method. 
    I have tried the event handlers on the form onupdating/oninserting/oninitialising and also table event handler onmodified but doesn't seem to hit the breakpoint when I debug.  

  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,587 Super User 2024 Season 1 on at
    RE: Set default value "Never" to expire after column, when new financial report is generated.

    Exactly, you should try COC on execute as it has public modifier. That should work.

    Also if coc doesn't work try event handler related to insert and update.

  • Benjamin long Profile Picture
    Benjamin long 40 on at
    RE: Set default value "Never" to expire after column, when new financial report is generated.

    Hi Bharani Preetham,

    Thank you for the suggestion, but I am only able to COC in execute method as other methods are private and unable to do so.




  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,587 Super User 2024 Season 1 on at
    RE: Set default value "Never" to expire after column, when new financial report is generated.

    I would suggest you to write this update or insert logic where the system is actually changing these values post next statement. For example in the updateReportVersionTable().

  • Benjamin long Profile Picture
    Benjamin long 40 on at
    RE: Set default value "Never" to expire after column, when new financial report is generated.

    Hi Rampal,

    I did a Coc on insert and update on the class.

    pastedimage1681435220171v2.png

    when i generate the report it shows "Never" but whenever i click another financial report and go back to the current report i generated. The "expire after" field changes to 90 days expiration instead of "Never".  

  • Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: Set default value "Never" to expire after column, when new financial report is generated.

    You can create extension class and CoC on insert and update method, check if value is inserting correctly in insert and if update method is called you can check table buffer and call stack.

  • Benjamin long Profile Picture
    Benjamin long 40 on at
    RE: Set default value "Never" to expire after column, when new financial report is generated.

    Hi Bharani Preetham,

    Thank you so much for you response, I have checked modified field/methods in the form there is no methods found.

    pastedimage1681378595345v1.png
    The execute standard method insert the record to financialreportVersion table, i have debug this and i can see my overwritten expiration date being updated correctly.

  • Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,587 Super User 2024 Season 1 on at
    RE: Set default value "Never" to expire after column, when new financial report is generated.

    Have you checked about modified field or modified methods? Also what did you find in execute query()?

  • Benjamin long Profile Picture
    Benjamin long 40 on at
    RE: Set default value "Never" to expire after column, when new financial report is generated.

    Hi Rampal,

    Thank you so much for your response, the table doesn't have any standard method. I also did a find reference to see if there is any customization or updating code to overwritten but couldn't find any.
    pastedimage1681376727487v1.png


    pastedimage1681376846107v2.png

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…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

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

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,846 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans