public void GetCustomObjectFields() { // assumes a custom object with id = 48 var response = _helper.GetCustomObjectFields(48); Assert.IsNotNull(response); }
public void FullImportTest() { // search for custom objects RestObjectList <CustomObjectSearchResponse> search = _dataHelper.SearchCustomDataObjects("*", 1, 50); List <CustomObjectSearchResponse> customObjects = search.elements; // retrieve the custom object uri string customObjectUri = customObjects[0].uri; // assume a known custom object id (use search endpoint for list) int customObjectId = 48; RestObjectList <Field> customObjectFields = _dataHelper.GetCustomObjectFields(customObjectId); foreach (Field customObjectField in customObjectFields.elements) { // select items to be included in the list of importFields Console.WriteLine("internal name: " + customObjectField.internalName); } // define the list of fields used in the import // for the purposes of this sample, the fields have been hardcoded Dictionary <string, string> importFields = new Dictionary <string, string> { { "Email_Address1", "{{CustomObject[48].Field[370]}}" }, { "First_Name1", "{{CustomObject[48].Field[371]}}" }, { "Last_Name1", "{{CustomObject[48].Field[372]}}" }, { "EmailAddressField", "{{CustomObject[48].Contact.Field(C_EmailAddress)}}" } }; // create the structure for the import Import import = _helper.CreateImportStructure(customObjectId, importFields); string importUri = import.uri; // define some sample data Dictionary <string, string> data = new Dictionary <string, string> { { "Email_Address1", "sample" }, { "First_Name1", "sample" }, { "Last_Name1", "sample" }, { "EmailAddressField", "*****@*****.**" } }; Dictionary <string, string> data2 = new Dictionary <string, string> { { "Email_Address1", "sample2" }, { "First_Name1", "sample2" }, { "Last_Name1", "sample2" }, { "EmailAddressField", "*****@*****.**" } }; List <Dictionary <string, string> > list = new List <Dictionary <string, string> > { data, data2 }; // import the data Sync sync = _helper.ImportData(importUri, list); Assert.IsNotNullOrEmpty(sync.uri); // poll results until the sync is complete RestObjectList <SyncResult> syncResult = _helper.CheckSyncResult(sync.uri); Assert.IsNotNull(syncResult); }