Skip to main content

Notifications

Announcements

No record found.

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

Request for Assistance: Adding Custom Fields to CustCollectionLetterTrans

(0) ShareShare
ReportReport
Posted on by 52

Hello everyone,

I am currently trying to add two custom fields to CustCollectionLetterTrans.
826515.png

Since these fields need to be automatically populated as soon as a record is created, I assumed that I could use either the insert or the initFromCustCollectionLetterJour method to populate the fields. However, it seems that neither of these methods is being executed, according to the debugger.
8232765.png

After some research, I discovered the createCustCollectionLetterTransForJournalSetbased method in the CustCollectionLetterCreate class, which appears to write data to the CustCollectionLetterTrans.
75575.png

My question now is, how can I modify the insert_recordset section to also populate my two custom fields?

Thank you for your help.

  • Suggested answer
    Jakob Becker Profile Picture
    Jakob Becker 52 on at
    RE: Request for Assistance: Adding Custom Fields to CustCollectionLetterTrans

    I wanted to share an update on my previous post regarding adding custom fields to CustCollectionLetterTrans in Dynamics 365 Finance.

    After trying out the suggestions provided by the community, I have found an alternative solution using the DataEventHandler.
    I am happy to report that this solution works and allows me to populate the custom fields in CustCollectionLetterTrans upon record creation.
    3872.Unbenannt.png

    I want to extend my gratitude to Martin Dráb who offered his insights and support in helping me find a solution to this issue.

    I hope this update can help anyone else who may be facing a similar challenge.
    Thank you for your help!

  • Jakob Becker Profile Picture
    Jakob Becker 52 on at
    RE: Request for Assistance: Adding Custom Fields to CustCollectionLetterTrans

    Thank you for your response and suggestion.

    I followed your advice and tried implementing a PreHandler on the CustCollectionLetterTrans.
    7167.Unbenannt.png

    However, it appears that also the PreHandler is not being executed.

    If anyone has any alternative suggestions or solutions to this problem, I would greatly appreciate it.
    Thank you for your time and assistance.

  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 230,962 Most Valuable Professional on at
    RE: Request for Assistance: Adding Custom Fields to CustCollectionLetterTrans

    You can't extend insert_recordset statement, you can't change code inside the standard method and you can't extend the method at all, because it's private. Either you'll find a different solution, or you'll need to ask Microsoft to make their code extensible.

    Note insert() method should be called even if insert_recordset is used, if insert() is overridden and skipDataMethods(true) wasn't called on the buffer before using it in insert_recordset. Of course, it would void benefits of insert_recordset, but maybe you're fine with it. What you're saying suggests that the system doesn't take CoC into account when determining whether insert() is overridden. What if you try an event handler instead?

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... 292,162 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,962 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans