0

I have recently started using your xero-php-oauth2 with the example code given, I am working through all and have had success

I have posted contacts into Xero with

$contact->setName($rs->bName)
            ->setFirstName($rs->fName)
            ->setLastName($rs->lName)
            ->setContactNumber($rs->numTo)
            ->setAccountNumber($rs->account_number)
            ->setAddresses($address)
            ->setIsSupplier(true)
            ->setDefaultCurrency($rs->currency)
            ->setPhones($phones)
            ->setEmailAddress($rs->email); 

All works well but now if I want to getContacts() with filter it is extremely difficult (stored as string not int) So if I set the filter:

$where='ContactNumber >= "10" AND ContactNumber <= "20"';

Returns 1,10,100,1000 etc; Is there a better way to do this without making an OR OR OR filter?

Also I can I add ContactGroup when creating Contact(Above), I have failed in every attempt, I can only do it once contact has been added?

Any help as always is appreciated! Many thanks

Barry

  • Because the contactnumber is an alphanumeric field, I suspect you're stuck with it working the way it does in terms of selecting a range. As for contact groups, the doc suggests that you use the Contactgroup endpoint to add contacts to a group, so it would suggest that must be done after the contact has been created. – droopsnoot Oct 24 '20 at 07:55
  • Thanks for the feedback do you know how to add contact group on creating contact? – learning from you Oct 27 '20 at 12:41
  • As above, I think you have to create the contact first, and then add that contact to the contact group once you have a UID for the contact. I have never done it, that's just based on the doc and the way that there's no mention of specifying a group in the contact endpoint. It seems that you add a contact to a group, you don't add a group to a contact. – droopsnoot Oct 27 '20 at 12:59

0 Answers0