I am working on a front-end for our Support staff to simplify managing of SalesForce cases. I am trying to implement a "take ownership" button, where a user can assign a case to themselves out of a SalesForce queue.

I am 99% of the way there, but the update() call fails with the following error:

INVALID_TYPE: Must send a concrete entity type.

Here is my code:

public static void AssignTo(this SFDC.Case sfcase, string NewOwner)
  var sf = sfSoap.getInstance();
  var owner = sfcase.Owner;

    var q1 = sf.query(@"SELECT Id, Name, Username FROM User WHERE Username='" + NewOwner + "'");
    List<SFDC.User> tmpName = sfSoap.ConvertToList<SFDC.User>(q1);
    Logger.getInstance().LogMessage("Found '" + NewOwner + "', id='" + tmpName[0].Id + "'");
    sfcase.OwnerId = tmpName[0].Id;

    SFDC.sObject[] toUpdate = new SFDC.sObject[1];
    toUpdate[0] = sfcase;
  catch (Exception ex)
    Logger.getInstance().LogMessage("AssignTo Error: " + ex.Message + "\n" + ex.StackTrace);

Some notes:

  • The SalesForce data types from the WSDL are in the SFDC namespace, e.g. SFDC.Case refers to a SalesForce Case object.
  • I can confirm that the query inside the try block is executing successfully and returning a valid object.
  • The sfSoap object is a simple wrapper around the SoapClient object.

I'm guessing that I'm not setting the OwnerId property to the right value, but you can't query Name objects so I'm not sure what precisely to do.

Thanks for any assistance.

  • Can you post the endpoint this is going to? Are you using the Partner or Enterprise API? – Richard N Jun 30 '14 at 21:07
  • It's the Enterprise API. – Nathan Strong Jun 30 '14 at 21:25
  • Please post your endpoint. – Richard N Jun 30 '14 at 21:33
  • You might try changing the type for the update to SFDC.Case instead of SFDC.sObject, based on the error message it sounds like it wants a specific sObject instead of the generic one ... – Ralph Callaway Jun 30 '14 at 22:17
  • No-go, @Ralph. Here is the endpoint config: <client><endpoint address="https://login.salesforce.com/services/Soap/c/27.0/0DFU0000000L60i" binding="basicHttpBinding" bindingConfiguration="SoapBinding" contract="SFDC.Soap" name="Soap" /></client> – Nathan Strong Jun 30 '14 at 22:28

I solved the issue.

The problem was, apparently, that the update() call really doesn't like it when you have a lot of data included in the object. Probably, something I was retrieving was not update()able.

So, the solution: create an empty object where only the object's Id and the fields that actually need to be updated (in my case, OwnerId) are set, and send that object to the update() call.

var tmp = new SFDC.Case();
tmp.Id = sfcase.Id;
tmp.OwnerId = tmpName[0].Id;
sf.update( new SFDC.Case[] { tmp } );
| improve this answer | |
  • I see that you are also using an array of SFDC.Case rather than SFDC.sObject. – Daniel Ballinger Jun 30 '14 at 23:08
  • Glad you solved it. – Richard N Jun 30 '14 at 23:19
  • Good approach, shame the error messages can be such a red herring trying to resolve this ... – Ralph Callaway Jun 30 '14 at 23:46

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.