Page 1 of 1

Using ReadRecord on SalesQuoteObject to open existing record

PostPosted: Mon Feb 15, 2010 3:07 pm
by hjones
Hi,

We would like a little guidance on using the readrecord method of the salesquoteobject when initialising the object from script. We use this successfully from within quote breakout's, so can only assume we have not initialised the object correctly.
Code: Select all
  Set myDatabase = CreateObject("jiwaodbc.database")
  Set JiwaCommLib = CreateObject("JiwaCommonLib.StdFunctions")
  Set JiwaLib = CreateObject("JiwaLib.StdFunctions")

  myDatabase.Connectiondetails = "Correct String here removed for forum..."
  myDatabase.IniFile = "Correct String here removed for forum..."
  Set SystemProfile = CreateObject("JiwaSysProfile.clsSysProfile")
  If myDatabase.MakeConnections(0) Then myDatabase.DoLogOn("Admin", "correct password removed here for forum..")

      '############### Create and Open existing Jiwa Quote Object
      Set SalesQuoteObject = CreateObject("JiwaSalesQuote.clsSalesQuote")
      Set SalesQuoteObject.Database = myDatabase
      Set SalesQuoteObject.JiwaCommLib = JiwaCommLib
      Set SalesQuoteObject.JLib = JiwaLib
      Set SalesQuoteObject.SystemProfile = SystemProfile
     
      SalesQuoteObject.Setup 'Needed?
      SalesQuoteObject.ReadDefaultBranch 'Needed?
      myVal = SalesQuoteObject.ReadRecord(0, 1, "QU000027434")
     
      wscript.Echo Chr(10) & "Return Value: " & myVal 'Expect -1 for success
      wscript.Echo SalesQuoteObject.ErrorString
     
      if myVal <> 1 then exit sub


The return code we are receiving on ReadRecord is "0" for failure, with the errorstring of "Error On Fetch : clsRecordSet.FetchRow - No Data Found". I am sure this is a simple case of neglecting to setup the object correctly.

Any help would be appreciated!

Jiwa Version 6.5.12 #HF3

Re: Using ReadRecord on SalesQuoteObject to open existing re

PostPosted: Thu Feb 18, 2010 4:10 pm
by Mike.Sheen
You'll need to instruct the system profile object which XML file you want it to read.

So, after this line in your code
Code: Select all
Set SystemProfile = CreateObject("JiwaSysProfile.clsSysProfile")


Add this one
Code: Select all
SystemProfile.Load(myDatabase.IniFile)


There may be other issues, but of the top off my head that is all I can immediately see.