Method Community

 

Adding tags with MethodAPIInsertV2

Last post 06-27-2018 12:20 PM by Colin. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 05-30-2018 11:18 AM

    • Colin
    • Top 500 Contributor
    • Joined on 05-30-2018
    • Posts 7

    Adding tags with MethodAPIInsertV2

    Hi, 

    I've been building a custom form for adding customers to Method, and I'm trying to get tags to be set with the new lead. 

    So far, I've went in to the edit contact page in Method and added a new tag, in this case, "NewTag".

    Then, in my array of fields being sent to method, I include 'TagList' with the value in the values array being ,'NewTag', (comma surrounded as suggested by Method).

    When I go to execute the script, the contact is added to Method properly, but just without the tags.

    I feel like I'm missing something small?

  • 05-30-2018 4:11 PM In reply to

    Re: Adding tags with MethodAPIInsertV2

    Hello Colin,

    There is no need for a comma to be surrounded in NewTag. Also just to make sure that we are on the same page with regards to inserting tags, is your work flow same as below? If not, the below should solve it.

    1. Use MethodAPIInsertV2 to Insert Customer Lead into the Customer table

    2. Retrieve ContactRecordID of the Customer Lead created in step 1 from the Contacts table (using MethodAPISelect_DataSetV2)

    3. Update TagList in the Contacts table for the ContactRecordID retrieved in Step2 using MethodAPIUpdateV2

    Laks Sahayaprasath
    Product Manager
    Method CRM
  • 06-01-2018 11:11 AM In reply to

    • Colin
    • Top 500 Contributor
    • Joined on 05-30-2018
    • Posts 7

    Re: Adding tags with MethodAPIInsertV2

    This was helpful, as I hadn't been using the Update API before this. 

    I've successfully gotten the UpdateAPI to update fields such as Telephone and Name at this point, but if I try and update the "TagList" field with a value of "NewTag", no tags are set and I can't view them on my contacts page. 

    This is a direct dump from my PHP script:

    nusoap_client created!
    processmethod.php:6 Posted data read and arrays constructed!
    processmethod.php:6 Fields: {"string":["Name","FirstName","LastName","CompanyName","Email","Phone","BillAddressAddr1","BillAddressCity","BillAddressState","BillAddressPostalCode","TagList","IsLeadStatusOnly"]}
    processmethod.php:6 Values: {"string":["Test TesterNEW","Test","TesterNEW","Gym TEst","tester@testingmethod.com","1234567890","NewTag","Yes"]}
    processmethod.php:6 Record inserted!
    processmethod.php:6 Response: Success
    processmethod.php:6 RecordID: 4970

    =====================NEXT FUNCTION=====================

    nusoap_client created!
    processmethod.php:11 Updated Field: ["TagList"]
    processmethod.php:11 Updated Values: ["NewTag"]
    processmethod.php:11 RecordID for update: 4970
    processmethod.php:11 Created Array for Updating Fields
    processmethod.php:11 Response: Success


    Any other fields seem to update without an issue, but the "TagList" field just doesn't seem to add the tags.

  • 06-01-2018 12:16 PM In reply to

    Re: Adding tags with MethodAPIInsertV2

    Hello Colin,

    In order to add taglist, you have to call Update API on the Contacts table rather than the Customer table. Taglist sits on the Contacts table and so in order to add taglist for your Leads insert the Lead into the Customer table successfully first, retrieve the contact of that Lead you just created and then call Update API on the Contacts table to add taglist for that contact.

    For future references call MethodAPIFieldListV2 for the table of any account. This will give you information about the list of supported fields, whether it supports add/edit etc.

    Laks Sahayaprasath
    Product Manager
    Method CRM
  • 06-06-2018 9:24 AM In reply to

    • Colin
    • Top 500 Contributor
    • Joined on 05-30-2018
    • Posts 7

    Re: Adding tags with MethodAPIInsertV2

    This helped out immensely. Everything is working after looking up the Entity_RecordID after creating  the contact and then crossreferncing the original contactID with the Entity_RecordID and using that number to update the listing in the Contacts table.

    However...

    It seems that every time I create a contact now using the API, it creates a new tag, in this case, "New Lead" rather than using the "New Lead" tag that is already built in. This leaves me with two different "New Lead" tags. Is there a way to set the built in tags using this method?

  • 06-06-2018 10:40 AM In reply to

    Re: Adding tags with MethodAPIInsertV2

    Hello Colin,

    Creating new contacts with the same Tag name works fine on our end and I dont see any duplicates being created. Also, just curious as to where you are seeing these duplicates? Is it possible that there is an extra space added somewhere in one of these "New Lead" tags? 

    Laks Sahayaprasath
    Product Manager
    Method CRM
  • 06-27-2018 12:20 PM In reply to

    • Colin
    • Top 500 Contributor
    • Joined on 05-30-2018
    • Posts 7

    Re: Adding tags with MethodAPIInsertV2

    Wasn't sure why it was acting the way it was, I just rearranged the order of the tags, and double checked for spaces or commas, and then it worked. Thanks so much, this helped so much! 

Page 1 of 1 (7 items)