Cancelling a GRN  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Cancelling a GRN

Postby DannyC » Tue Jun 16, 2020 3:59 pm

I have a request from a client to stop some users from creatng GRNs to certain creditors.
I can easily write a plugin to check the creditor and the user, but when I use
Code: Select all
throw new JiwaFinancials.Jiwa.JiwaApplication.Exceptions.ClientCancelledException();

It lands back at the newly created GRN with the creditor there in the form.

I want to either i) clear the creditor which will allow the user to just select another creditor or
ii) simulate clicking the cancel button on the ribbon so they just need to start a new GRN.

I've tried
Code: Select all
GRN.Creditor.Clear()
but that doesn't do anything.
And I am not sure of the correct syntax to simulate clicking the cancel button.
User avatar
DannyC
Senpai
Senpai
 
Posts: 636
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 30

Re: Cancelling a GRN

Postby SBarnes » Tue Jun 16, 2020 4:31 pm

There is NewRecord on the Form or CreateNew on the Receival but you'll need to get a valid creditor Id first.

But a better option would be to take over the new tool click and filter the creditors they can choose in the first place by getting in on the set up before, why let them do something that you are going to stop in the first place.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: Cancelling a GRN  Topic is solved

Postby Scott.Pearce » Tue Jun 16, 2020 4:34 pm

Before throwing your cancel, do this:

Code: Select all
GRNForm.ReadRecord(IJiwaNavigable.ReadModes.Actual)
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: Cancelling a GRN

Postby DannyC » Tue Jun 16, 2020 7:26 pm

Almost Scott. That function needs the ID as a string.
So I just did a simple SQL SELECT to find the most recent GRN for that warehouse & get the PackSlipID.

Works a treat now, so thanks, that will probably suffice.
Stuart's idea has merit and is worth looking into but for now GRNForm.ReadRecord(PackSlipID) does the trick.
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 2 guests

cron