Page 1 of 1

Determining if an order is a credit note in SO Create New BF

PostPosted: Wed Sep 03, 2014 10:33 am
by changsen.wu
I am referring 6.5.13 vbscript breakout using COM.

In the sales order create new before breakout, the signature of the function is
Sub SalesOrderCreateNewBefore(MDIParentObject, FormObject, SalesOrderObject, NewSalesOrderType, DebtorSeed, DebtorSeedIsID, InvoiceHistoryID, JobID, QuoteID, rtnCancel, Static1, Static2, Static3, Static4, Static5, Static6)

I am trying to determine if it is the creation of a new credit note or sales order and set value to rtnCancel based on certain criteria. However, it appears that at this point, SalesOrderObject.CreditNote is always false even if a credit note is created (i.e., the Salesorder COM CreditNote property doesn't seem to have been set yet). Is there any other way to determine if it is a credit note. I can't use Sales Order Create Completed event because at this point, it is not possible to abort the creation of an SO (as it does not contain rtnCanel parameter). While I could get around the issue by disabling the credit note creation menu, and then recreate my own version as custom menus in SO (by calling the function mRecordNewNote_Click, assuming it is public, associated with credit note creations and setting one of the static variables before hand to indicate a credit note), it's a major pain and I'd prefer to see if there is a more elegant method.

Re: Determining if an order is a credit note in SO Create Ne

PostPosted: Wed Sep 03, 2014 10:47 am
by Mike.Sheen
changsen.wu wrote:Sub SalesOrderCreateNewBefore(MDIParentObject, FormObject, SalesOrderObject, NewSalesOrderType, DebtorSeed, DebtorSeedIsID, InvoiceHistoryID, JobID, QuoteID, rtnCancel, Static1, Static2, Static3, Static4, Static5, Static6)

I am trying to determine if it is the creation of a new credit note or sales order and set value to rtnCancel based on certain criteria. However, it appears that at this point, SalesOrderObject.CreditNote is always false even if a credit note is created


Hi Changsen,

The NewSalesOrderType parameter will be NewSalesOrderTypes.e_NewSalesOrderCreditNote (1) when the SalesOrderCreateNewBefore event is raised when creating a credit note. If it is a credit note based on a sales order, then the InvoiceHistoryID parameter will be non-blank.

Mike