JiwaCollection violates constraint error  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

JiwaCollection violates constraint error

Postby Riyaz » Wed Jan 08, 2020 2:14 am

Hi There'

When I try to process the salesorder am getting the below error, the error triggers on the line SalesOrder.Process(), can you pls kindly advise on this

GenericArguments[0], 'JiwaFinancials.Jiwa.JiwaCashBook.CashBookTransaction', on 'JiwaFinancials.Jiwa.JiwaApplication.JiwaCollection`1[T]' violates the constraint of type parameter 'T'.

Code used is as below

Using JiwaCon As New SqlConnection(_Login.JiwaConnectionString)
Dim manager As New JiwaFinancials.Jiwa.JiwaApplication.Manager()
manager.Logon(JiwaCon.DataSource, JiwaCon.Database, JiwaFinancials.Jiwa.JiwaODBC.database.AuthenticationModes.JiwaAuthentication, _Login.UserName, _Login.Password)
SalesOrder = manager.BusinessLogicFactory.CreateBusinessLogic(Of JiwaSales.SalesOrder.SalesOrder)(Nothing)
SalesOrder.Read(_InvoiceID)
SalesOrder.Process()
End Using
Riyaz
Kohai
Kohai
 
Posts: 233
Joined: Wed Dec 02, 2015 2:05 pm
Topics Solved: 2

Re: JiwaCollection violates constraint error

Postby SBarnes » Wed Jan 08, 2020 6:37 am

Hi Riyaz,

Processing a sales order shouldn't go anywhere near the cash book, is there the possibility that your code is causing another plugin to fire?

I would suggest trying the sales order processing code against a demo database and see if you get the same error as you may find the error is particular to the database you are using.

Also look at the stack trace for the exception that is being thrown that is giving you the error as this might give you more a clue to the source.
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1618
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: JiwaCollection violates constraint error

Postby DannyC » Thu Jan 09, 2020 3:23 pm

Is there a payment on the sales order?
User avatar
DannyC
Senpai
Senpai
 
Posts: 636
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 30

Re: JiwaCollection violates constraint error  Topic is solved

Postby Mike.Sheen » Sun Jan 12, 2020 7:21 pm

DannyC wrote:Is there a payment on the sales order?


Payments on sales orders do create a cash book entry or append to an existing one (depending on dates and the presence of a cash book entry for the same date and also system settings), and so it does create a cash book object when processing a sales order.

The error is interesting - it indicates to me perhaps mismatched Jiwa assemblies - the cash book assembly being used is not what is expected by the factory of the JiwaApplication.

The version of Jiwa being used will be helpful to know - and also if this is a non-clean environment (as in a dev environment - often dev environments have multiple versions of Jiwa assemblies laying around) the version of the JiwaApplication and JiwaCashBook assemblies will be of use - if they are different then that could be a problem.
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


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 2 guests

cron