function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Marty Y. ChangMarty Y. Chang 

SOAP error from calling sforce.apex.execute method in JavaScript custom button

Does anyone have any ideas on why I’m getting this error when trying to execute Apex via Javascript in a custom button?

 

{faultcode:'soapenv:Client', faultstring:'The content of elements must consist of well-formed character data or markup.', }

 

I’m trying to following the example in the documentation below:

 

“Apex in AJAX”

http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#StartTopic=Content/apex_and_ajax.htm?SearchType=Stem

 

My Apex class method is essentially as follows:

 

global class MyInterface {
  webService static void performInterfaceAction(List<Id> accountIds) { }
}

 

My JS in the button is as follows:

 

{!REQUIRESCRIPT("/soap/ajax/21.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/21.0/apex.js")}

var result = sforce.apex.execute("MyInterface", "performInterfaceAction", {!GETRECORDIDS( $ObjectType.Account )});

alert(result);

location.reload(true);

 

b-Forceb-Force

Below code returns comma sepereted list of Ids , Not List<Id>, try with changing argument of service as string then work on it

 

{!GETRECORDIDS( $ObjectType.Account )}