Sales Order line adding, when does it fire in v 7.2?  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Sales Order line adding, when does it fire in v 7.2?

Postby DannyC » Tue Aug 28, 2018 2:53 pm

Typically I use the SalesOrder.SalesOrderLineAdding or SalesOrder.SalesOrderLines.Adding when I need to write some code to intercept for whatever reason adding an item to a sales order. e.g. maybe that staff isn't allowed to add that item, or it doesn't comply with some other rule.

This has worked fine up to 7.0.175.

I'm doing some plugins in 7.2 and I am finding that both those events fire when a sales order is loaded also, not just when a line is added.

The only event which seems to fire as a sales order line is added is SalesOrder.SalesOrderLines.AddInventoryItemStart. The problem with AddInventoryItemsStart is that it has the following arguments
Code: Select all
string inventorySeed, JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrderLineCollection.SalesOrderLineInventorySeedTypes KitSeedType, ref object NewKey ,JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrderLine KitHeader, int LineNumber)

but the SalesOrderLine object KitHeader is null.

So I guess the issue is twofold
i) The line adding events fire even if you're just loading a sales order, it shouldbe when a new item is added
ii) The KitHeader object passed into AddInventoryItemsStart is null. Shouldn't it be the line object?

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

Re: Sales Order line adding, when does it fire in v 7.2?  Topic is solved

Postby Scott.Pearce » Tue Aug 28, 2018 3:09 pm

You can still use SalesOrder.SalesOrderLineAdding or SalesOrder.SalesOrderLines.Adding, just take a look at the Item.SalesOrderLines.Reading property in your code to determine whether to execute or not.
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: Sales Order line adding, when does it fire in v 7.2?

Postby Scott.Pearce » Tue Aug 28, 2018 3:12 pm

Further, in AddInventoryItemStart, the KitHeader object will only be set to a sales order line object when the line being added is a kit component - the KitHeader indicates what it's kit header line is (if any).
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: Sales Order line adding, when does it fire in v 7.2?

Postby DannyC » Tue Aug 28, 2018 4:51 pm

the KitHeader object will only be set to a sales order line object when the line being added is a kit component


Ahhhh, I get it.
I've been able to use the Reading property, so all good.
User avatar
DannyC
Senpai
Senpai
 
Posts: 636
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 30


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 13 guests