You need to sign in to do that
Don't have an account?
Keaton Klein
sobject type 'Trust_Contact__C' not supported
I have written some code which adds records to an object. In case case i am trying to add a record to a custom object. When running this code i get an error message stating that the sObject type 'Trust_Contact__C' is not supported. As a test a created a new custom object 'Test_Object__C" and ran the same exact code but changed the type to 'Test_Object__C' and i commented out the a few of the fields (second code sample). What really confuses me is that it worked with the Test Object and not with the Trust Contact object. I also inserted screenshots from each object in Salesforce. Any ideas?
cmd.CommandText = "SELECT top(10) dbo.keat_crossreference.* FROM dbo.keat_crossreference"; cmd.CommandType = CommandType.Text; cmd.Connection = sqlConnection1; sqlConnection1.Open(); reader = cmd.ExecuteReader(); var nexty = reader; // Data is accessible through the DataReader object here. int ir = 0; sObject[] cons = new sObject[1]; apex.sObject contact; var pretrust ="pre"; var buildid = ""; var pair = ""; var crdesc = ""; var acctno = ""; var naidno = ""; while (reader.Read()) { if (reader.GetValue(reader.GetOrdinal("account_no")).ToString()==pretrust) { buildid = buildid +','+ reader.GetValue(reader.GetOrdinal("buildid")).ToString(); pair = pair + ',' + reader.GetValue(reader.GetOrdinal("pair")).ToString(); crdesc = crdesc + ',' + reader.GetValue(reader.GetOrdinal("cross_ref_type_cd_dsc")).ToString(); acctno = acctno + ',' + reader.GetValue(reader.GetOrdinal("account_no")).ToString(); naidno = naidno + ',' + reader.GetValue(reader.GetOrdinal("name_addr_id")).ToString(); pretrust = reader.GetValue(reader.GetOrdinal("account_no")).ToString(); ir++; } else { ir++; pretrust = reader.GetValue(reader.GetOrdinal("account_no")).ToString(); //Verify that we are already authenticated, if not //call the login function to do so if (!loggedIn) { if (!login()) return; } try { for (int j = 0; j < cons.Length; j++) { contact = new apex.sObject(); int index = 0; System.Xml.XmlElement[] cont = new System.Xml.XmlElement[17]; if (accounts != null) { cont = new System.Xml.XmlElement[cont.Length + 1]; cont[index++] = GetNewXmlElement("AccountId", accounts[0]); } cont[index++] = GetNewXmlElement("contact__C", naidno); cont[index++] = GetNewXmlElement("Relationship_Type__c", crdesc); //cont[index++] = GetNewXmlElement("Role__c", addy1); cont[index++] = GetNewXmlElement("Trust__c", acctno); contact.Any = cont; contact.type = "Trust_Contact__C"; cons[j] = contact; } SaveResult[] sr = binding.create(cons);
//cont[index++] = GetNewXmlElement("contact__C", naidno); //cont[index++] = GetNewXmlElement("Relationship_Type__c", crdesc); //cont[index++] = GetNewXmlElement("Role__c", addy1); cont[index++] = GetNewXmlElement("name", acctno); contact.Any = cont; contact.type = "Test_Object__c"; cons[j] = contact;
All Answers