Notifications
Announcements
No record found.
Hi All,
Please can you help me changing below code so It looks at two columns 'InventTransId' and 'InvoiceId' to find appropriate transaction.
As per below Snip InvenTransId is used to locate specific transaction.
I need help adding InvoiceId as second parameter to filter transaction.
Appreciate your help on this.
Hi YOG,
Do you mean that you want to find transaction by InvoiceId ?
Try this code:
CustTrans custTrans=CustTrans ::findFromInvoice(invoiceId);
Hope this helps.
Hi Will,
I want to find transaction by both InventTransId and InvoiceId.
Below code did not work!
Seems you have some challenges with the x++ syntax.
Please replace the "&&" with ";" in end of line 8. Then you get rid of this syntax error. Remember that each line should end with semicolon (";"). Your code looks like you perhaps forgot that.
If you still have issues, could you please invest a bit of your time in describing your requirement in as much detail as possible! It would greatly help us in providing best possible assistance, therefore directly helping you achieve your goal. Thanks!
Thanks Nikolaos,
I have changed the code and tried entity but still no luck
Here is what I am trying to do.
I have custom data entity looking for CostAmount from LotTransaction screen (Sales ledger > Inquiries and Reports > Invoice > Invoice Journal > Invoice line > Stock > Lot transactions)
In below screenshot, item has been invoiced 4 time from sales order. currently above code is pulling out 13,235.99 for each invoice, which is wrong. I want to modify code so I looks at Costamount by InvoiceId
Unfortunately I don't see your second screenshot.
Anyway your current code fetches two table buffers: CustInvoiceTrans and CustTrans. Later in the method you only use values from CustInvoiceTrans.
Perhaps you should use CustInvoiceTrans::findCustInvoiceTrans method to find the record that you need? I don't know what information you have in your entity so I don't know what parameters you can provide in the search.
Ok, now I see your screenshot. Unfortunately I don't even know what form is "Lot transactions"? Seems you are using D365 with British English (en-gb) where the terminology is a bit different than in en-us. Could you switch to en-us and tell me the name of the form, and more important, the name of the table. Also, is this table also the main data source for your entity? If not, which is?
Hi Nicolaos,
I have set my prefrences to en-us.
screen is called 'lot transactions' and I am navigating (Account Receivable> Inquiries and Reports > Invoice > Invoice Journal > Invoice line > Inventory> Lot transactions)
Table and Main Data source for my entity - CustInvoiceTrans
Just to add up.
here is a screenshot of CustInvoiceTrans Table where there are 4 invoices for same InventTransId
So, the data source for your entity is CustInvoiceTrans. And you want to find the current data source CustInvoiceTrans record, so that you can call some methods of that record and populate some virtual fields of your entity.
Either your entity has, or you can add an internal field from CustInvoiceTrans.RecId.
Then you can find the exact correct CustInvoiceTrans via CustInvoiceTrans::findRecId(this.RecId);
Put this in the beginning of your postLoad() method and your other fields should get correct value.
That worked. Thank you Nikolaos:)
Here is the code that worked,
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 551 Most Valuable Professional
André Arnaud de Cal... 450 Super User 2025 Season 2
BillurSamdancioglu 278 Most Valuable Professional