top of page
  • antoineabastian

Missing invoices in collection letters

1 - Use case


When we first started generating collection letters in D365 F&O, we noticed that some customer transactions of the type invoice were missing in the collection letter.

After investigating, I realized that the parameter Collection letter from the customer posting profile were turned off for a couple of weeks by mistake, then turned on again.

That means some customer transactions were not tagged for being part of a collection letter.

The collection letter field on the CustTrans table were blank for some transactions.

In the initFromPostingProfile() method, the value of the field CollectionLetter is inherited from the posting profile.



In other terms, if the Collection letter toggle is not turned on in the posting profile, the CollectionLetter in the CustTrans table is blank.


Those transactions are not picked up by D365 F&O when the collection letter is created.

A database update is required.

2 - Create the x++ script


Log in Visual studio.


Select Extensions > Model management > New model.


You can call it Hotfix.

Add a new class called UpdateCustTrans:


class HANA_UpdateCustTrans

{

public static void main(Args _args)

{

CustTrans _custrans;

update_recordset _custrans

setting CollectionLetter = NoYes::Yes

where _custrans.Closed == mkDate(1900,01,01) && _custrans.CollectionLetter == NoYes::No;

}

}


Build the solution.


Create a deployable package.


Select the model you created.


Copy/paste the package on your local machine.

Log in D365 F&SCM (test environment).

Navigate to System administration > Periodic tasks > Database > Custom scripts.


Click Upload.


Change the user as it needs to be different from the user who uploaded it.


Go to Details > Process flow.


Select Approve.


Run test.


When the test is completed, select Run.


The status moves to Run completed.


96 views0 comments

Recent Posts

See All
bottom of page