Hello everyone!
I need some help in understanding how to change the default value of a field in a standard form through extension. I have searched both in this forum and on google, finding some different solutions, but I noone of them have worked for me (or, maybe, I have applied them in the wrong way). I am working on dynamics 365 version 10.0.29
Here is my case in detail:
- When you have to post a new vendor invoice, you go to Accunts payable -> Invoices -> Invoice Journal. Here, you create a new journal, then you open it clicking on its voucher or on the "Lines" button above. In this form there is a tab called "Invoice" and inside it a group called "Approve". In this group there is a flag called "Approved" that's true by default, and a lookup called "Approved by" with the name of the approver. All these things are standard Microsoft.

- What I need to achive is to change the default values of the field so that the flag is false by default and the user will eventually change it if needed, and the lookup should be empty.
- This fields should be on the "LedgerJournalTrans" table, as far as I know.
- As I am extending the standard, I have a limted range of choices to achive it: I can't change the default value of the fields from the form extension in Visual Studio, and I can't use the methods but only the events provided.
- I tried retrieving the controls of the form and changing their values; I tried retrieving the datasource in various points of execution (form init, datasource init, etc) and change the values of the fields directly on it... Sometimes I received a null pointer exception, sometimes I had no errors but the fields were unchanged.
- Searching in the code, I suspect that there is some standard code that initialize this fields automatically based on the type of journal you are using, but I am not sure. In particular, I suspect that the ckass LedgerJournalEngine is involved in a way I still don't understand, but maybe I am wrong.

I thught that would be an easy task, but seems I was wrong. I hope anyone will be able to help me.