1

I am using a List custom button in Listview once I select the records through checkboxes then the script will call and get the list of id's and pass them to apex class methods, but at that point I am getting not the id's.

var records = {!GETRECORDIDS($ObjectType.Sample__c)};
var prodRecorIds= "";

if (records[0] == null) {
  alert("You have not selected any record.");
} else {
  for (i = 0; i < records.length; i++) {
     prodRecorIds += records[i] + ",";
  }
}
sforce.apex.execute("ListviewController","updateEuro",{prodids:"{+ prodRecorIds}"});
window.location.reload();

I am passing the list of id's in +prodRecorIds in execute method, but I didn't get the id. Instead of ids it passes the 'prodRecorIds' string. How can I resolve this issues?

3

You are not passing prodRecordsIds correctly.

in execute method :

Replace

prodids:"{+ prodRecorIds}"

with

prodids:"{"+ prodRecorIds+"}"

Always check error console while working with javascript.

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.