Method Community


Strange behavior of Customer.BillAddressAddr1 when adding via MethodAPIInsert

Last post 10-20-2013 12:18 PM by dbornet. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 10-17-2013 9:46 PM

    Strange behavior of Customer.BillAddressAddr1 when adding via MethodAPIInsert

    I can duplicate this at will.

    It goes like this (in all examples below, assume additional fields for valid strCompanyAccount, strLogin and strPassword, also assume that my actual code syntax is correct with all proper quotes and so on):

    I use MethodAPIInsert to insert a record into the Customer table, with the following field/values:

    Name = Daria Test1
    FirstName = Daria
    CompanyName = MyCompany
    BillAddressAddr1 = "1 Main St".

    I then (in the same code, immediately afterwards) use MethodAPISelect_XML with the following field/values

    strTable = Customer
    strFields = Name, FirstName, CompanyName, BillAddressAddr1
    strWhereClause = "FirstName = 'Daria'"
    strGroupByClause, strHaving and strOrderBy are empty.

    IOW I pull all records where the first name is Daria.

    It returns the following.  This is correct.

        <Name>Daria Test1</Name>
        <BillAddressAddr1>1 Main St</BillAddressAddr1>

    NOW I take the same code and change the insert field values as follows:

    Name = Daria Test2
    BillAddressAddr1 = "2 Main St".

    other fields stay the same as they were.

    I then run all this again (which does another insert and select, so there should now be two records with first name of Daria).

    What it gives me is this:

        <Name>Daria Test1</Name>
        <BillAddressAddr1 />
        <Name>Daria Test2</Name>
        <BillAddressAddr1>2 Main St</BillAddressAddr1>

    Take a good look at the first record.  What happened to the address?

    This repeats - if I add a 3rd record, it keeps its address but the 2nd record loses it.

    If I now go into Method CRM and look at the records I created (any of them), the address is missing.  And, having done so, if I now do just a select using the API function, the address is gone from all the records.

    Is there something special about Addr1 that it should not be used?

    Please advise...

  • 10-18-2013 8:18 AM In reply to

    Re: Strange behavior of Customer.BillAddressAddr1 when adding via MethodAPIInsert

    Yes, the Addr1-5 fields are special - there are operations happening in QuickBooks to re-arrange the data.  If you put data in Method, it will send it to QuickBooks, but then QuickBooks will re-arrange it and update Method to change the info.  It is a major pain.

    Have you checked to see if the address you put in the BillAddr1 field has been moved to BillAddr2?  QuickBooks wants a Name in BillAddr1.

    -Mary Longacre
  • 10-20-2013 12:06 PM In reply to

    Re: Strange behavior of Customer.BillAddressAddr1 when adding via MethodAPIInsert

    Ah!  That makes sense, thanks.

    No, what I put into Addr1 didn't move to Addr2, I was testing with Addr1 and Addr2, Addr1 disappeared (or sometimes got replaced by CompanyName) and Addr2 stayed put.

    Perhaps you can just advise me on how to do what I need to do.

    Via the API, what I'm trying to add is a Lead, not a Customer.

    The lead has a name (first/last), a company name, an address (two lines thereof plus city, state and zip), phone number, email, website and a couple of other datums.  This all comes from a form that was filled in on our website.

    Other than the two lines of address, here are the fields I've populated: Name, FirstName, LastName, CompanyName, BillAddressCity, BillAddressState, BillAddressPostalCode, Phone, Email, Website, AltPhone and AssignedTo.

    I've had no trouble with all of the various pieces except for the two lines of address, and how to flag that this record is a lead and not a customer.

    Based on records already in Method that I exported and looked at, and based on what you wrote, I'm thinking (haven't tested this yet) that I should put the lead name into Addr1, my two lines of address into Addr2 and Addr3, set IsLeadStatusOnly to true, set EntityType to 'Customer Lead' and set LeadStatus to 'Open'.

    Is that correct, or do you advise something else?

    Thanks for your help!

  • 10-20-2013 12:18 PM In reply to

    Re: Strange behavior of Customer.BillAddressAddr1 when adding via MethodAPIInsert

    I tried this.  Had to remove "EntityType" which is a field that doesn't support Add.  Then it worked fine.

Page 1 of 1 (4 items)