1

I'm trying to create one or more contacts by Java SOAP Enterprise API but I'm getting error. This is the code:

for (int i=0;i<5;i++) {
      Contact c = new Contact();
      c.setFirstName("aaaa");
      c.setLastName("bbbb");
      c.setTitle(""+i);
      c.setDepartment(""+i);
      c.setBirthdate(null);
      c.setReportsToId(null);
      c.setLeadSource(""+i);
      c.setMailingAddress(null);
      c.setDescription(""+i);
      c.setHomePhone(""+i);
      c.setMobilePhone(""+i);
      c.setFax(""+i);
      c.setEmail("aaa"+i+"@bbb.com");

      contacts[i] = c;
  }

And this is the error:

`[InvalidSObjectFault [ApiQueryFault [ApiFault  exceptionCode='INVALID_TYPE' exceptionMessage='Must send a concrete entity type.' extendedErrorDetails='{[0]}'] row='-1' column='-1']]

Thanks in Advance.

  • Is your array of exactly length 5? Leaving null (empty) entries in the array by having an array larger than 5 can produce that error (if the comment on this question Update user object using SOAP Api is correct). – Keith C Aug 24 '16 at 17:17
  • Yes @KeithC , I did a System.out.println(contacts.length); and it returned 5. – Julio C. Boll Aug 24 '16 at 17:24
  • @KeithC : what is d relation of array size to this error. i think each array record will be having value not null. yes, but some field would be null. – Ankuli Aug 24 '16 at 17:30
  • @Ankuli yep, Fields can be null but I think @KeithC said like an Array a = new Array[5] with a[4] = null – Julio C. Boll Aug 24 '16 at 17:37
  • My concern was that if the array was say 8 long, the last 3 values would be left null because values are only being set for the first 5. – Keith C Aug 24 '16 at 19:24
1

Not sure when you're getting this error, but could it be that you're not setting the AccountId on the Contact object and it's required?

  • Could you maybe add any further detail to back up your hypothesis? – Adrian Larson Sep 23 '16 at 20:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.