Prevent SO Save Event  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Prevent SO Save Event

Postby Riyaz » Tue Sep 15, 2020 4:36 pm

Hi There

We have a custom plugin wherein we need to prevent the save event at certain times, the code is running at save start and also initiating cancel exception, but it still seems to save the SO. Can you pls advise, have attached the plugin for your reference
Attachments
Plugin SNE - Sales Orders.xml
(40.37 KiB) Downloaded 20 times
Riyaz
Kohai
Kohai
 
Posts: 233
Joined: Wed Dec 02, 2015 2:05 pm
Topics Solved: 2

Re: Prevent SO Save Event

Postby Mike.Sheen » Tue Sep 15, 2020 5:44 pm

That works for me.

I had to comment out a bunch of code to try and repro the issue, however - because your plugin refers to custom fields not present in the plugin you provided.

Attached is the modified version of your plugin I tested with - and using that when I save a sales order, it prompts me if I want to continue saving and when I answer 'No', it does not save and returns to the sales order in edit mode.
Attachments
Plugin SNE - Sales Orders.xml
(41.31 KiB) Downloaded 25 times
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: 2440
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 755

Re: Prevent SO Save Event  Topic is solved

Postby Riyaz » Thu Sep 17, 2020 3:45 pm

Hi Mike

Thanks for your reply, actually, there was another exception after this where the problem was, found the cause, ok now, issue was that was inside a try catch block so it was getting caught. Thanks for your support.
Riyaz
Kohai
Kohai
 
Posts: 233
Joined: Wed Dec 02, 2015 2:05 pm
Topics Solved: 2

Re: Prevent SO Save Event

Postby Mike.Sheen » Fri Sep 18, 2020 2:15 pm

Riyaz wrote:Hi Mike

Thanks for your reply, actually, there was another exception after this where the problem was, found the cause, ok now, issue was that was inside a try catch block so it was getting caught. Thanks for your support.


Ahh, I see that now - the problem code was below where I was looking - I just tested the first scenario I came across where you were performing a throw.

If I looked through all your code, I would have found where you had a throw inside a try catch and the catch swallowed the exception inside a handler of the sales order SaveStart event - which is where your problem was.

If we had just the relevant code to the problem inside the plugin, that would have saved us all a lot of time. A lesson learned for the next time!
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: 2440
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 755


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 2 guests

cron