Now Available in Community - MBAS 2019 Presentation Videos
Catch the most popular sessions on demand and learn how Dynamics 365, Power BI, PowerApps, Microsoft Flow, and Excel are powering major transformations around the globe. | View Gallery
2019 release wave 2 Discover the latest updates to Dynamics 365Release overview guides and videos Release Plan | Early Access Availability
Ace your Dynamics 365 deployment with packaged services delivered by expert consultants. | Explore service offerings
Connect with the ISV success team on the latest roadmap, developer tool for AppSource certification, and ISV community engagements | ISV self-service portal
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance and Operations TechTalks | Customer Engagement TechTalks | Talent TechTalks
Hello! I have a problem with posting additional General Journal Line right after post Vendor Ledger Entry.
What am I doing and what I want to achieve?
In CU90 there is a function PostGLAndVendor and in it the PostVendEntry, which creates GenJnlLine and post it. I need to create additional GenJnlLine and post it too, but if my additional posting will end with error, all changes should roll back. The issue is that when the second posting ends with error, the Posted Purchase Invoice is still permanently posted in system with all G/L Lines etc.
My second idea was that. I will create function in codeunit 90 right after MakeInventoryAdjustment, before UpdateLastPostingNos functions. And strange things are happening now. My function only create TWO General Ledger Entries and post it. For debbuging I gave an ERROR('Rollback') instead my function and it was OK! After ERROR all changes was rolled back. But if my function is handled, on VALIDATE Account No. field there is a code, which is checking if Vendor f.ex. is blocked. After this validation and system error my posted invoice is still posted. I don't know why!
Could you tell me, when the posting transaction starts and where ends? And how can I achieve the posting of additional general journal lines in ONE transaction?
Where did you add the code to create additional G/L Line? Do you want to post this line before or after the Vendor Entry?
I want to post my line AFTER post orginal Vendor Entry. I've created my code right after GenJnlPostLine.RunWithCheck(GenJnlLine) in PostVendorEntry function in Codeunit 90.
Did you add any commit in your code? can you share your code
No, because I don't want to end the transaction.
Please share your code, what functions you are calling for posting?
The same function as orginal...
PostVendorEntry Function: https://i.imgur.com/GIpDAad.jpgTryPostSecondGJLine Function: https://i.imgur.com/HHmFr2t.jpg
Instead of validating fields in your second function, just assign the values and try. If any error occurs it should rollback everything.
Business Applications communities