Method Community

 

API POST Contact / Not OtherName

Last post 02-07-2023 8:07 PM by sp9001. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 01-31-2023 9:03 PM

    API POST Contact / Not OtherName

    When I'm creating a new contact record with the API or even with an action set. The new contact type is always "OtherName"

    Does anyone know what is causing this? Or how I can go about automatically making a new contact record without it saying this? It should just be "Customer" but I cannot figure it out.

  • 02-02-2023 10:19 AM In reply to

    Re: API POST Contact / Not OtherName

    Hi there!

    The Contact should belong to an Entity, otherwise it is orphaned. Entities are existing customers, vendors, or OtherName.


    This is a JSON I just posted to create a contact:

    {
    "FirstName" : "Peter",
    "LastName" : "Greenman",
    "Name" : "Peter Greenman",
    "Entity" : "Supply Central",
    "Phone" : "(555) 555-1234"
    }



    It gave me back the RecordID of the newly created contact. When I query the Contacts for that RecordID I get back this:

    {
    "RecordID": 144,
    "Email": null,
    "FirstName": "Peter",
    "IsOptOutOfBilling": false,
    "IsOptOutOfMarketing": false,
    "LastName": "Greenman",
    "Name": "Peter Greenman",
    "Note": null,
    "Phone": "(555) 555-1234",
    "PortalPassword": null,
    "PortalUserName": null,
    "SpecialType": null,
    "Title": null,
    "Mobile": null,
    "FaceBookUserName": null,
    "LinkedInPublicUserName": null,
    "TwitterUserName": null,
    "Website": null,
    "AltPhone": null,
    "Pager": null,
    "TagList": null,
    "ProfilePic": null,
    "ProfilePicFileName": null,
    "ProfileImage": null,
    "ProfileImageFileName": "PG-6.mci",
    "IsExcludedInAERO": false,
    "InstagramUserName": null,
    "LastModifiedDate": "2023-02-02T15:15:03.653",
    "DirectDial": null,
    "SkypeUserName": null,
    "Entity": "Supply Central",
    "Entity_RecordID": 283,
    "AccountNumber": "",
    "Balance": 1177.0000,
    "BillAddressAddr1": "Supply Central",
    "BillAddressAddr2": "John Supplier",
    "BillAddressAddr3": "",
    "BillAddressAddr4": "",
    "BillAddressAddr5": "",
    "BillAddressCity": "",
    "BillAddressCountry": "",
    "BillAddressNote": "",
    "BillAddressPostalCode": "",
    "BillAddressState": "",
    "BirthDate": null,
    "Campaign": null,
    "Class": null,
    "CompanyName": "Supply Central",
    "CreditLimit": null,
    "CustomerType": null,
    "EmployeeType": null,
    "EntityRecordID": 283,
    "EntityType": "Vendor",
    "Fax": "",
    "FullName": "Supply Central",
    "Gender": null,
    "IsActive": true,
    "IsLeadStatusOnly": false,
    "JobDesc": "",
    "JobEndDate": null,
    "JobProjectedEndDate": null,
    "JobStartDate": null,
    "JobType": null,
    "ParentFullName": null,
    "PreferredPaymentMethod": null,
    "PriceLevel": null,
    "PrintAs": "",
    "ResaleNumber": "",
    "SalesRep": null,
    "SalesTaxCode": null,
    "SalesTaxItem": null,
    "ShipAddressAddr1": "",
    "ShipAddressAddr2": "",
    "ShipAddressAddr3": "",
    "ShipAddressAddr4": "",
    "ShipAddressAddr5": "",
    "ShipAddressCity": "",
    "ShipAddressCountry": "",
    "ShipAddressNote": "",
    "ShipAddressPostalCode": "",
    "ShipAddressState": "",
    "Sublevel": null,
    "Terms": null,
    "TotalBalance": 0.0000,
    "VendorType": null,
    "SalesRepRecordID": null,
    "LeadStatus": "Qualified",
    "LeadSource": null,
    "LeadRating": null,
    "LeadConvertedDate": "2011-10-31T22:23:40",
    "EntityCreatedDate": "2011-11-01T02:23:28.013",
    "LastActivityCompletedDate": "2019-04-19T18:57:54.203",
    "LastCompletedActivity": 287,
    "NextActivityDueDate": null,
    "NextPendingActivity": null,
    "AssignedTo": null,
    "AssignedToRecordID": null,
    "Currency": null,
    "TenantID": 1,
    "TenantID_RecordID": 1
    }

    So the missing piece for you is to assign the Entity in your contact creation.
    Paul
  • 02-02-2023 10:29 AM In reply to

    Re: API POST Contact / Not OtherName

    Thanks for the reply Paul, When you created your contact it looks like it made it as a vendor, how would you specify vendor or contact when creating?

  • 02-02-2023 10:42 AM In reply to

    Re: API POST Contact / Not OtherName

    The Entity ""Supply Central" already existed, and existed as a Vendor.

    The relationship between an Entity and a Contact is that an Entity have 1 or many Contacts.

    So I could have:

    Entity (Customer): Bob Crenshaw

    Contact 1: Bob Crenshaw

    Contact 2: Betty Crenshaw

    Or a business

    Entity (Customer): XYZ Industries

    Contact 1: Jane Doe


    Or a supplier

    Entity (Customer): Supply Centry

    Contact 1: Mary Jane

    Contact 2: Michael Tyson



    So, before you create a contact, first make sure an entity exists, and specify that entity in your create request.


  • 02-02-2023 9:45 PM In reply to

    Re: API POST Contact / Not OtherName

    I'm sorry. I guess then what I'm trying to do is create a new entity that does not set it self as the type "OtherName"

    When I post to the entity end point say this data

    {
    "Name": "Prime Ribs",
    "FullName": "Prime Ribs",
    "EntityType": "Customer",
    "IsActive": true,
    "Sublevel": 0,
    "CompanyName": "Prime Ribs",
    "NameOnCard": "Prime Ribs",
    "NameOnCheck": "Solis Foods",
    "TenantID": 1,
    "Currency": "CAD",
    "Currency_RecordID": 196
    }

    It comes back like this

    {
    "RecordID": 305,
    "Name": "Prime Ribs",
    "FullName": "Prime Ribs",
    "EntityType": "OtherName",

    How can I create a new customer type, and not Entity type?

  • 02-03-2023 11:21 AM In reply to

    Re: API POST Contact / Not OtherName

    So, we aren't making this easy on you!  

    Instead of creating an Entity, create a Customer.   That will automatically create an Entity with EntityType Customer.  

    Here's one I created using PostMan: https://imgur.com/a/BH1Ezn8


    Note, when you create a new Customer, it will automatically create a Contact for you. You can query for this contact using the Customer/Entity RecordID that is returned.

    In my example here, I got back RecordID 474.

    So my RestAPI URL to get the Contact added for that Customer/Entity was:

    {{baseUrl}}/api/v1/tables/Contacts?filter=Entity_RecordID eq 474


    Sorry this was so confusing!


    Paul

  • 02-04-2023 8:46 PM In reply to

    Re: API POST Contact / Not OtherName

    Ok I think the problem I was running into was that I was hitting the Contact end point, and nothing was happening. But I hit the customer end point and it will make the entity, and the contact at the same time?

    Is that similar if I am making a new customer from an action set? Do I create a new record in the customer table instead of the contact or entity table?

  • 02-06-2023 10:14 AM In reply to

    Re: API POST Contact / Not OtherName

    Answer

    "Ok I think the problem I was running into was that I was hitting the Contact end point, and nothing was happening. But I hit the customer end point and it will make the entity, and the contact at the same time?"

    -Yes. This is correct.

    -Worth pointing out though, that you may still need to use the Contact end point to create additional contacts for that same customer.

    -You might also need to use the Contact end point to edit more Contact fields of that primary contact. 



    "Is that similar if I am making a new customer from an action set? Do I create a new record in the customer table instead of the contact or entity table?"

    -Exactly the same. Making it via actions should have the same behaviour as via the API.

  • 02-07-2023 8:07 PM In reply to

    Re: API POST Contact / Not OtherName

    Fantastic, thanks for the clarification. I really appreciate your help with tis

    Party!!!

Page 1 of 1 (9 items)