You need to sign in to do that
Don't have an account?
Arthur Lockrem
Passing a generic SObject to a SOAP web service via Ajax Toolkit
I need the ability to pass a generic SObject to a SOAP web service. When I specify the SObject type (ie. Account) it works fine.
The following works:
webService static String testUpsert(Account o) { try { upsert o; return o.Id; } catch (Exception e) { return e.getMessage(); } }
When I change it to an SObject it fails. In fact, it acts like the method doesn't exist (nothing gets returned).
The following does not work:
webService static String testUpsert(SObject o) { try { upsert o; return o.Id; } catch (Exception e) { return e.getMessage(); } }
Here is the JavaScript code I'm using to execute the SOAP methods.
function doTest() { sforce.connection.init("{!$API.Session_ID}"); var acc = new sforce.SObject("Account"); acc.Name = "a - JS Test Account 1"; var result = sforce.apex.execute("ws_Test", "testUpsert", {o:acc}); alert('result - ' + result); }
Any help is appreciated.
I am experiencing the same issue. Any help would be greatly appreciated.
Thanks!