You need to sign in to do that
Don't have an account?
Milan Tomic 14
SOAPI API: INVALID_TYPE: Must send a concrete entity type
Hi
While executing this code:
Task[] records = new Task[5];
QueryResult queryResults = connection.query("SELECT Id, Subject, Description FROM Task LIMIT 5");
if (queryResults.getSize() > 0) {
for (int i = 0; i < queryResults.getRecords().length; i++) {
Task d = (Task) queryResults.getRecords()[i];
d.setDescription(d.getDescription() + " -- UPDATED");
records[i] = d;
}
}
// update the records in Salesforce.com
SaveResult[] saveResults = connection.update(records);
I got this error:
[InvalidSObjectFault [ApiQueryFault [ApiFault exceptionCode='INVALID_TYPE'
exceptionMessage='Must send a concrete entity type.'
]
row='-1'
column='-1'
]
]
Any idea what could be wrong? :)
While executing this code:
Task[] records = new Task[5];
QueryResult queryResults = connection.query("SELECT Id, Subject, Description FROM Task LIMIT 5");
if (queryResults.getSize() > 0) {
for (int i = 0; i < queryResults.getRecords().length; i++) {
Task d = (Task) queryResults.getRecords()[i];
d.setDescription(d.getDescription() + " -- UPDATED");
records[i] = d;
}
}
// update the records in Salesforce.com
SaveResult[] saveResults = connection.update(records);
I got this error:
[InvalidSObjectFault [ApiQueryFault [ApiFault exceptionCode='INVALID_TYPE'
exceptionMessage='Must send a concrete entity type.'
]
row='-1'
column='-1'
]
]
Any idea what could be wrong? :)
If there aren't 5 records that need an update you are likely passing in an array with null elements. E.g. Think about what would happen if there is only one Task in Salesforce that matches your SOQL query.
Try making a new collection of records to hold the records that need an update an only pass those over.
All Answers
this does not seem to be an apex code. This code should work for oyu
If there aren't 5 records that need an update you are likely passing in an array with null elements. E.g. Think about what would happen if there is only one Task in Salesforce that matches your SOQL query.
Try making a new collection of records to hold the records that need an update an only pass those over.
Yes, I did not had 5 elements in array but only 1 or 2. Creating a new array just before connection.update(records) call, solved a problem :)
records = Arrays.copyOf(records, queryResults.getSize());