Sales order Lines > Invoice > Generate (Invoice) > PrintMgnmt > OK
i need to run a method after Generating Sales Invoice
I tried putting the code in the last part or closeOK and closedOK (i tried info("aa"); first)
but when i tried it, it will prompt before the Confirmation Warning ("Warning: You are posting the invoice and printing to screen only.").
how can i put it after the Warning and everything is OK and POSTED.
please help. thanks.
*This post is locked for comments
I've also had forms that need to appear after some form letter document is posted, such as the Sales invoice.
Try launching your form in the SalesFormLetter_Invoice class in the run() method after the super() call. Make sure NOT to launch your form when it's not appropriate. For example, if the Sales invoice is proforma, then there will be no records left, so probably not useful to launch your form. If the thread is a CLR session, then you won't be able to run client code at all and it will error if you try.
Here's a sample of code that I've actually used for this purpose. In my case I only wanted the form to appear if the form letter document wasn't printed, hence the !this.printFormLetter() check.
super();
if (!this.salesParmUpdate().Proforma && !this.printFormLetter() && this.parmShowDialog()) { if (xGlobal::hasClient() && !xSession::isCLRSession()) { // launch your form here } }
a good approach can be to follow the path of sales invoice report, i.e. as you are going to post an invoice there is checkbox, if you check it,, it prints sales invoice report, else it ignores it. in case you marked this checkbox of printing invoice, it is printed only in case, invoice has no issues and everything is fine. i.e after posting the invoice the printout appears.
so do follow the same logic and let your custom form appear somewhere before or after that report because till that moment,, invoice is already posted (either in case of Performa or actual posting)
Hi martin,
im supposed to run a custom form that su,mmarizes and splits the sales invoice by 15 lines each, and giving them each a preprinted si number for printing. I msnaged to make it and it is working now (tested it All in custom tables/forms to run).
But now i need to deploy it in the SI posting now, which is the problem, i need posted SI before running the custom form.
How can i run it after posting SI(after all the warnings yes/no)
Posting is done in SalesInvoiceJournalPost class. You can find it by yourself next time in Using the Refactored Formletter Framework.
I can't say what would be the place for your business logic because you didn't tell us anything about it.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156