Sales Orders. Event after all kit components have been added  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Sales Orders. Event after all kit components have been added

Postby DannyC » Fri Sep 14, 2018 12:19 pm

Hi,
I'm looking for an event which fires after all kit components have been added.
I thought I could use
Code: Select all
salesOrderForm.SalesOrder.SalesOrderLines.KitAdded
but it doesn't fire. Not sure if it's a bug - I am using 7.2.

Anyway, I thought I could use instead
Code: Select all
salesOrderForm.SalesOrder.SalesOrderLineAdded
but it fires when the kit header has been added, before all the kit components have been added.

I need to interrogate all the kit components (via the LineAdded event and checking for SalesOrderKitLineTypes.e_SalesOrderKitComponent), then do some stuff if any kit components meet a condition once all components have been added.

I'm struggling to find the best way to do this. Any assistance would be appreciated.

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

Re: Sales Orders. Event after all kit components have been a

Postby Mike.Sheen » Fri Sep 14, 2018 12:30 pm

Hi Danny,

The SalesOrderLines has a special event "AddInventoryItemEnd" which is raised at the very end of adding an inventory item to a sales order - including after all components are added.

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: 2445
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 757

Re: Sales Orders. Event after all kit components have been a

Postby Scott.Pearce » Fri Sep 14, 2018 12:31 pm

Try using
Code: Select all
salesOrderForm.SalesOrder.SalesOrderLines.AddInventoryItemEnd


EDIT: Beaten by Mike!
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 743
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 221

Re: Sales Orders. Event after all kit components have been a

Postby DannyC » Fri Sep 14, 2018 12:42 pm

lol. Nice to have double confirmation!

Testing now.......


EDIT: That isn't firing either. Bug? Other suggestion?
EDIT 2: Ok, getting wierder. I created a brand new plugin without any other code. And all I have is a MessageBox to prove that it is firing. And guess what? Both SalesOrderLines.KitAdded and also SalesOrderLines.AddInventoryItemEnd are both working OK! Go figure. I have no idea why they're not firing in my plugin which has other code on other events.

Is there any way that those events can be prevented from firing?

EDIT 3: So this is getting stranger. I remmed out ALL my code & am just left with a simple MessageBox on the KitAdded event. Exactly as per new plugin but with different naming for the code blocks. And it still doesn't fire. I also have some custom fields in my plugin, on Inventory Maintenance.
Last edited by DannyC on Fri Sep 14, 2018 1:19 pm, edited 1 time in total.
User avatar
DannyC
Senpai
Senpai
 
Posts: 638
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 30

Re: Sales Orders. Event after all kit components have been a

Postby Scott.Pearce » Fri Sep 14, 2018 1:09 pm

Fires for me on 7.2. I've attached a test plugin.
Attachments
Plugin AddInventoryItemEnd Test.xml
(32.47 KiB) Downloaded 74 times
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 743
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 221

Re: Sales Orders. Event after all kit components have been a

Postby Scott.Pearce » Fri Sep 14, 2018 1:11 pm

If the add is cancelled, i.e. something is listening to the Adding event and setting it's e.Cancel property to true.

You should disable all other plugins, then start stripping back your code to isolate.
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 743
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 221

Re: Sales Orders. Event after all kit components have been a

Postby DannyC » Fri Sep 14, 2018 1:36 pm

I think I have a workaround.
It seems 99% certain that my original plugin had some odd corruption, coz I just created a new plugin, copied all my code over & now it IS firing on KitAdded!
User avatar
DannyC
Senpai
Senpai
 
Posts: 638
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 30

Re: Sales Orders. Event after all kit components have been a  Topic is solved

Postby Mike.Sheen » Fri Sep 14, 2018 1:42 pm

DannyC wrote:I think I have a workaround.
It seems 99% certain that my original plugin had some odd corruption, coz I just created a new plugin, copied all my code over & now it IS firing on KitAdded!


If weird stuff like that happens, just exit Jiwa, and then delete the \ProgramData\Jiwa Financials\Jiwa 7 folder - that'll remove any previously built assemblies and force a recompile when you login.

You shouldn't have to do that, as we do update the *.dll.RowHash file in the \ProgramData\Jiwa Financials\Jiwa 7\...\Runtime folders whenever a plugin is edited, which will cause the plugin to be recompiled on login - but there is the odd occasion where I've seen the assembly in the Runtime folder of the plugin somehow stale - so a previous version of the plugin is actually run.
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: 2445
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 757


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 13 guests

cron