CustomerNo$ not on file

We have no issues creating AR invoices in the ProvideX library with Sage 100 Advanced. We have several clients using our integration (all with Advanced). We were told our code would not need to change to support Premium (SQL). After setting up Premium on our test server we noticed an issue. 

When creating invoices, one of the fields specified is the Customer Number field (CustomerNo$). We use the following line of code to set the CustomerNo field. (the CustomerNo displayed in Mas90 is "0000001").

ProvideXObject.InvokeMethod(this.Object, "nSetValue", CustomerNo$, 0000001);

We're getting the following error...

CI_NOF: 0000001 is not on file

I looked at the database and noticed the CustomerNo is "01" so I tried that value - same result. I noticed it has an ARDivisionNo of "00" so I tried "0001" - same result. I also tried these same values after adding AR Divisions.  No difference.

Any idea why this is not working?  I'm curious why this would work fine in Advanced but not in Premium.

Thanks for any help you can provide.

  • 0

    Set ARDivisionNo, then CustomerNo.  This is done separately, and Premium is no different from Standard/Advanced functionality.

  • 0 in reply to Kevin M

    Thank you for the reply. We are setting the ARDivisionNo before setting the CustomerNo. Below is the entire list until it errors out at the CustomerNo.  Again, all this same code works fine in Advanced but not Premium. Any other ideas? Could it be a setup issue?

    ProvideXObject.InvokeMethod(this.Object, "nSetValue", ARDivisionNo$, 00);
    ProvideXObject.InvokeMethod(this.Object, "nSetValue", CustomerNo$, 01);
    ProvideXObject.InvokeMethod(this.Object, "nSetValue", InvoiceDate$, 20230131);
    ProvideXObject.InvokeMethod(this.Object, "nSetValue", CustomerPONo$, 6842853);
    ProvideXObject.InvokeMethod(this.Object, "nSetValue", TermsCode$, 01);
    ProvideXObject.InvokeMethod(this.Object, "nSetValue", InvoiceDueDate$, 20230302);
    ProvideXObject.InvokeMethod(this.Object, "nSetValue", DiscountDueDate$, 20230210);
    ProvideXObject.InvokeMethod(this.Object, "nSetValue", SalespersonDivisionNo$, 00);
    ProvideXObject.InvokeMethod(this.Object, "nSetValue", SalespersonNo$, 0002);
    ProvideXObject.InvokeMethod(this.Object, "nSetValue", CommissionAmt, 69.42);

  • 0 in reply to Patrick1

    Try wrapping your text strings in quotes.  Sage methods are sensitive to type.

  • 0 in reply to Kevin M

    The InvokeMethod is our code which is passing strings. The list above is a copy/paste from our log file. Any other ideas?

  • 0 in reply to Patrick1

    Check the EditState of your object.  It should be 2 for a new record.  Check the return values for your get next / set invoice# to make sure you aren't having errors earlier in the process.

    Reset the business object's LastErrorMsg before each suspect statement, and then log LastErrorMsg afterwards...

    "retSet:  " & cStr(retSet) & "  LastErrorMsg: " & oBusObj.LastErrorMsg

  • 0 in reply to Kevin M

    How do I check the EditState and set the LastErrorMsg in c#?  Most of our framework code Invokes methods but doesn't set properties?

  • 0 in reply to Patrick1

    I don't know c#, sorry.  I only do scripting within the Sage interface (VBScript / UDS), not externally.  Someone else will have to help you with that.

    EditState is just a property of the object.  This is a bit of VBScript that I use to remind me of the values.

    retval = 0
    if oBusObj.EditState = 1 then 'existing record
        retVal = oSession.AsObject(oSession.UI).MessageBox("Existing Record")
        else if oBusObj.EditState = 2 then 'new record
            retVal = oSession.AsObject(oSession.UI).MessageBox("New Record")
            else ' edit state 0 the only other option
                retVal = oSession.AsObject(oSession.UI).MessageBox("No Record in memory")
        end if
    end if

    For the error message, I'd do something like this:

    oSomeObject.EditState = ""

    retSet = oSomeObject.DoSomething(stuff)

    retVal = oSession.AsObject(oSession.UI).MessageBox("retSet:  " & cStr(retSet) & "  LastErrorMsg: " & oSomeObject.LastErrorMsg)

    ' Note: 1=success, 0=failure, -1=warning... you should only get a LastErrorMsg when the return value / retSet is not 1 (success).

    ' You want to clear LastErrorMsg before your statement to ensure you are getting a fresh message, not a leftover LastErrorMsg value from a previous command.

  • 0 in reply to Kevin M

    Better yet, if you had a VBScript sample that connected to Sage 100 that simply created a customer then I can test it on my end. (even better if you had a script that created an AR invoice). With a script I can arrive at the root issue much sooner (whether it's buried in our c# code or Mas90 setup). Again, I'm going from the premise our c# code works fine (as it does for several clients as we speak) for Standard/Advanced and should be the same for Premium. The other advantage is if it turns out code related I can then make the changes necessary to our c# code for Premium. Can you please provide me a VBScript where I can then fill in the necessary pieces to determine the root cause?

  • 0 in reply to Patrick1

    I don't do scripts that are triggered externally, only internally.  There are probably examples on Sage City of the kind of things you want to do... but I don't have any to share.

  • 0 in reply to Kevin M

    It could be something silly, like you're not setting the module date.  It's a company option and your previous systems may have it set automatically (which has nothing to do with Premium vs S/A).  Or Role permissions...  That's why you want to check the retVal's and LastErrorMsg values, to ensure each step in the process works without an error.