Page 1 of 1

Email after Processed

PostPosted: Thu Jun 24, 2021 5:34 pm
by DannyC
Using this as a basis viewtopic.php?f=26&t=592
I have a plugin which emails the debtor when a sales order is processed. Plugin attached.

It works fine when the print selection box is opted to "No Report".

But if the user chooses "Single Report" or "Report Type" I get an error "Unable to start the print job. It may not be possible in the current security context."

I've been scratching my head over this one for quite some time & just can't work out where the plugin is faulty. Would appreciate a heads up!

Re: Email after Processed

PostPosted: Thu Jun 24, 2021 5:46 pm
by Mike.Sheen
I get an exception when processing a sales order with your plugin because it's referring to a custom field "ProcEmail" which isn't defined anywhere by the plugin (it's probably in a different plugin of yours?).

Having said that, I don't think that's related to the error you are getting. That particular message is more related to the printer configuration - check the print groups for the user you are testing as and make sure the printer for the sales order report exists for that user.

Re: Email after Processed  Topic is solved

PostPosted: Thu Jun 24, 2021 5:59 pm
by Scott.Pearce
I think the user may be using Jiwa via RDS and is trying to print to a redirected printer which is either not mapped via their session or is no longer valid.

Check Jiwa logical printers and try to avoid mapping to logical printers to RDS-mapped printers. Such printers should be shared and accessible as a local printer via the RDS server.

Re: Email after Processed

PostPosted: Thu Jun 24, 2021 11:56 pm
by DannyC
Sweet. I fixed up my logical printers. I needed to specify an actual printer not just leave default as blank.

new error.
Unable to update table SO_Main with InvoiceNo [100570],
InvoiceID [whatevertheIDis]

It performs the print and processes the invoice but doesn't email.

EDIT:
I've worked it out...I needed to add a line in the processed sub to re-read the sales order after it had been printed, i.e.
Code: Select all
   Public Sub salesOrder_Processed(sender As Object, e As System.EventArgs)
      Dim salesOrder As JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrder = DirectCast(sender, JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrder)
      salesOrder.Read(salesOrder.InvoiceID)


Thanks for the help as always.

Re: Email after Processed

PostPosted: Fri Jun 25, 2021 9:00 am
by SBarnes
Try re-reading the sales order before you do anything, the processing will have just performed as save so reading it will set everything back to where it needs to be in terms of statuses etc.