How to retrieve a customer filtered by email

Options
Joe_10453072
Joe_10453072 Member Posts: 17
edited July 2020 in Accounts Hosted
Hello guys

Using API and QBXML, I'd like to retrieve a customer filtered by email. How to do it? Like this:

<?xml version="1.0"?>
<?qbxml version="6.1"?>
<QBXML>
<QBXMLMsgsRq onError="continueOnError">
<CustomerQueryRq>
  <!-- Like: SELECT * FROM Customer WHERE Email = 'foo@eample.com' -->
  <Email>foo@example.com</Email>
</CustomerQueryRq>
</QBXMLMsgsRq>
</QBXML>

Or using Name

<?xml version="1.0"?>
<?qbxml version="6.1"?>
<QBXML>
<QBXMLMsgsRq onError="continueOnError">
<CustomerQueryRq>
  <!-- Like: SELECT * FROM Customer WHERE Name = 'Joe' -->
  <Name>Joe</Name>
</CustomerQueryRq>
</QBXMLMsgsRq>
</QBXML>
Thanks

Comments

  • PhuongDo
    PhuongDo Reckon Developer Partner Posts: 314 ✭✭✭
    edited July 2020
    Options
    Hi Joe,

    You can only query by name, but not email.

    For name, the XML should be:

    <CustomerQueryRq>
       <NameFilter>
           <MatchCriterion >StartsWith OR Contains OR EndsWith </MatchCriterion>
            <Name>Joe</Name>
       </NameFilter>
    </CustomerQueryRq>

    With this approach, you will need to iterate through the response to get the correct one.

    If you have the full name, the query should be:

    <CustomerQueryRq>
       <FullName >STRTYPE</FullName> <!-- You can have more than one FullName node if you want to search by mutiple fullname-->
    </CustomerQueryRq>

    If you really want to search by email, you should store the customer info (probably ListID, Name and email or any other detail if you don't want to query Reckon again) in an external database. Then you can query by anything you like. But with this approach, you will need to do incremental query/update whenever you connect to Reckon as you don't want to have out of date data in your external db.

    Hope it helps.

    Thanks,

    Phuong
    phuong@cactussoftware.com.au


    Phuong Do / Reckon Developer Partner

    phuong@cactussoftware.com.au


  • Joe_10453072
    Joe_10453072 Member Posts: 17
    edited March 2020
    Options
    Hi Phuong

    Thank you for your reply.

    I understood about "StartsWith OR Contains OR EndsWith". Why they didn't provide "equal" or like that...
    Just in case, I'll prepare about mapping table between "ListID" and "Email".

    Thanks
  • Joe_10453072
    Joe_10453072 Member Posts: 17
    edited March 2020
    Options
    Hum...

    I can specify only one for MatchCriterion. I cannot use specify exact matching with "Name"...
  • PhuongDo
    PhuongDo Reckon Developer Partner Posts: 314 ✭✭✭
    edited March 2020
    Options
    Yep, it is the limitation. Again, if you want to be able to search by exact name or email, you will need to go through the custom database solution approach.


    Phuong Do / Reckon Developer Partner

    phuong@cactussoftware.com.au