7 Replies Latest reply on Aug 20, 2019 12:00 PM by EdDierker

    Can you automatically create linked Contacts from CDO data created via Application API?

    BCG

      I'm trying to implement a scenario where linked Contacts are automatically created if necessary based on CDO data that is added via the Application API, similar to what happens if you check the "Map data cards" checkbox when uploading data to a custom object.

       

      I know that one possibility would be use the API to check if a matching Contact already exists, create it if it does not, and then used the contact ID that is returned as part of the API call that creates the CDO data.  This actually seems like a fine solution to me, but I am exploring if there are other and possibly better options for getting this done.

       

      For example, I thought about using Program Canvas to have a process whenever new CDO records are added... but could not find a way to have it create a linked contact without sending it to Program Builder.

       

      I was able to get most of what I wanted working by creating a Custom Object Service and having an action that creates the contact... this also seems like an OK solution to me, but I've been led to believe that I should be creating new stuff with Program Canvas when possible, and also I'd prefer to not have to maintain the Custom Object Service if possible

       

      Any suggestions on the "right" or "best" way to make this happen?

       

      Thank you

        • 1. Re: Can you automatically create linked Contacts from CDO data created via Application API?
          nathan.lichte

          You can use 'Custom Object Record Services' to save to the contact table and/or update contact records; this uses the old form processing steps but runs on program builder schedule (one step every 15 minutes)

           

          Nathan

          • 2. Re: Can you automatically create linked Contacts from CDO data created via Application API?
            Lou Patrick

            The "Map data cards" checkbox can not be applied to the APIs.

             

            With the Application API, you could perform another request to update the contact after creating the custom object record.

             

            With the Bulk API, you can include contact fields in the custom object import. Here is an example import definition for a custom object with an id of 9:

             

            POST /api/Bulk/2.0/customObjects/9/imports

             

            {

                "mapDataCards": true,

                "mapDataCardsCaseSensitiveMatch": false,

                "mapDataCardsEntityField": "{{Contact.Field(C_EmailAddress)}}",

                "mapDataCardsSourceField": "customObjectEmail",

                "mapDataCardsEntityType": "Contact",

                "name": "Custom Object Import with Contact Updates",

                "updateRule": "always",

                "fields": {

                    "customObjectEmail": "{{CustomObject[9].Field[103]}}",

                    "customObjectFirstName": "{{CustomObject[9].Field[104]}}",

                    "contactFirstName": "{{CustomObject[9].Contact.Field(C_FirstName)}}"

                },

                "identifierFieldName": "customObjectEmail",

                "isSyncTriggeredOnImport": true

            }

            Here is a tutorial for importing data via the Bulk API.

            • 3. Re: Can you automatically create linked Contacts from CDO data created via Application API?
              Devon Guerrero

              So the "mapDataCards": true, is the equivalent of the "map data cards" checkbox?

              • 4. Re: Can you automatically create linked Contacts from CDO data created via Application API?
                Lou Patrick

                There could be small differences, but for the most part yes. See details on the Bulk API mapDataCards parameters within the Using import and export parameters.

                • 5. Re: Can you automatically create linked Contacts from CDO data created via Application API?
                  EdDierker

                  I tried to follow these instructions, but I received an error "Must contain the Contact email address field in the fields (since a linked Contact field is included)."  When I add a field for the Contact Email address ("emailAddress":"{{CustomObject[96].Contact.Field(C_EmailAddress)}}")  The Import definition gets created and I can add the data to import (I'm just manually writing a single record in JSON for testing), but I get "There was an error processing the import" in the sync logs.

                  • 6. Re: Can you automatically create linked Contacts from CDO data created via Application API?
                    Lou Patrick

                    If you share the full import definition, I could take a look.

                    • 7. Re: Can you automatically create linked Contacts from CDO data created via Application API?
                      EdDierker

                      sure.  I started off easy with the import, but plan to add more.

                       

                      {

                          "mapDataCards": true,

                          "mapDataCardsCaseSensitiveMatch": false,

                          "mapDataCardsEntityField": "{{Contact.Field(C_EmailAddress)}}",

                          "mapDataCardsSourceField": "customObjectEmail",

                          "mapDataCardsEntityType": "Contact",

                          "name": "Custom Object Import with Contact Updates",

                          "updateRule": "always",

                       

                       

                          "fields": {

                              "customObjectEmail": "{{CustomObject[96].Field(Email_Address1)}}",

                              "contactCompany": "{{CustomObject[96].Contact.Field(C_Company)}}",

                              "contactFirstName": "{{CustomObject[96].Contact.Field(C_FirstName)}}",

                              "contactLastName": "{{CustomObject[96].Contact.Field(C_LastName)}}",

                              "contactTitle": "{{CustomObject[96].Contact.Field(C_Title)}}",

                              "contactAddr1": "{{CustomObject[96].Contact.Field(C_Address1)}}",

                              "contactAddr2": "{{CustomObject[96].Contact.Field(C_Address2)}}",

                              "contactCity": "{{CustomObject[96].Contact.Field(C_City)}}",

                              "contactState": "{{CustomObject[96].Contact.Field(C_State_Prov)}}",

                              "contactZip": "{{CustomObject[96].Contact.Field(C_Zip_Postal)}}",

                              "contactCountry": "{{CustomObject[96].Contact.Field(C_Country)}}",

                              "contactEmail": "{{CustomObject[96].Contact.Field(C_EmailAddress)}}",

                              "contactPhone": "{{CustomObject[96].Contact.Field(C_BusPhone)}}",

                              "contactZip": "{{CustomObject[96].Contact.Field(C_Zip_Postal)}}",

                              "contactVertical": "{{CustomObject[96].Contact.Field(C_Vertical1)}}",

                              "customObjectFormComment": "{{CustomObject[96].Field(Form_Comments1)}}",

                              "customObjectLeadRating": "{{CustomObject[96].Field(Lead_Rating1)}}",

                              "customObjectSalesOwner": "{{CustomObject[96].Field(CRM_Lead_Owner1)}}",

                              "customObjectSalesOwnerEmail": "{{CustomObject[96].Field(CRM_Lead_Owner_Email1)}}",

                              "customObjectCampaignID": "{{CustomObject[96].Field(Campaign_ID1)}}",

                              "customObjectSource": "{{CustomObject[96].Field(Lead_Source1)}}",

                              "customObjectFeature": "{{CustomObject[96].Field(Feature_Interest1)}}"

                       

                       

                          },

                       

                       

                          "identifierFieldName": "customObjectEmail",

                          "isSyncTriggeredOnImport": false

                      }