salesOrderForm.SalesOrder.CreateEnd not firing for credits  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

salesOrderForm.SalesOrder.CreateEnd not firing for credits

Postby DannyC » Thu Jan 25, 2018 12:48 pm

Hi,
Just writing a fairly simple plugin on salesOrderForm.SalesOrder.CreateEnd.

It needs to run for both sales orders and credit notes but I've just proven that it doesn't run the Sub if it's a credit note. Version 7.1
Is this normal?

Cheers
User avatar
DannyC
Senpai
Senpai
 
Posts: 636
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 30

Re: salesOrderForm.SalesOrder.CreateEnd not firing for credi

Postby SBarnes » Thu Jan 25, 2018 10:36 pm

Hi Danny,

You may find that the behaviour doesn't run if you create the credit note from an existing order but will run if you create the credit note and don't relate it to an existing order at least that's my experience.

Why this is the case though I don't know.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: salesOrderForm.SalesOrder.CreateEnd not firing for credi

Postby Mike.Sheen » Mon Jan 29, 2018 9:14 am

Hi Danny,

I believe the Created event is fired for all types of sales order (from quote, credit note from existing so, et cetera) - the CreatEnd isn't fired in all circumstances because of difficulty with the UI handling all scenarios correctly.

Mike
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: salesOrderForm.SalesOrder.CreateEnd not firing for credi

Postby DannyC » Wed Jan 31, 2018 8:45 am

This doesn't work. Error on compile...
Code: Select all
    Public Sub Setup(ByVal JiwaForm As JiwaApplication.IJiwaForm, ByVal Plugin As JiwaApplication.Plugin.Plugin) Implements JiwaApplication.IJiwaFormPlugin.Setup
       Dim salesOrderForm As JiwaSalesUI.SalesOrder.SalesOrderEntryForm = DirectCast(JiwaForm, JiwaApplication.IJiwaForm)
      'AddHandler salesOrderForm.SalesOrder.CreateEnd, AddressOf GetUSDFX
      AddHandler salesOrderForm.SalesOrder.Created, AddressOf GetUSDFX
    End Sub
   
   Private Sub GetUSDFX(sender As Object, e As System.eventargs, NewSalesOrderType As JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrder.NewSalesOrderTypes, SourceQuoteObject As JiwaFinancials.Jiwa.JiwaSales.SalesQuote.SalesQuote)
.
.
.

Method GetUSDFX does not have a signature compatible with delegate....
I'm pretty sure I have all the passed in objects which the Created event needs, so not sure on fixing up this error.
User avatar
DannyC
Senpai
Senpai
 
Posts: 636
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 30

Re: salesOrderForm.SalesOrder.CreateEnd not firing for credi  Topic is solved

Postby Scott.Pearce » Wed Jan 31, 2018 8:51 am

The event CreateEnd expects a signature like:

Code: Select all
GetUSDFX(sender As Object, e As System.EventArgs)


(and "sender" will be a sales order object).

Whereas Created expects a signature of:
Code: Select all
GetUSDFX(sender As Object, e As System.EventArgs, ByVal NewSalesOrderType As NewSalesOrderTypes, ByRef SourceQuoteObject As JiwaSales.SalesQuote.SalesQuote)

(and "sender" will be a sales order object).

Note that the Created signature expects ByRef SourceQuoteObject As JiwaSales.SalesQuote.SalesQuote - I suspect this is your problem. Insert the ByRef keyword into your declaration.
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 742
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 221

Re: salesOrderForm.SalesOrder.CreateEnd not firing for credi

Postby DannyC » Wed Jan 31, 2018 8:56 am

yay - and so fast too. I needed ByRef.

cheers
User avatar
DannyC
Senpai
Senpai
 
Posts: 636
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 30

Re: salesOrderForm.SalesOrder.CreateEnd not firing for credi

Postby Scott.Pearce » Wed Jan 31, 2018 9:09 am

8-)
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 742
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 221


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 36 guests