+ Start a Discussion

In Javascript how to display all the selected records for sucess??

Hi All,


I have a Javascript code to send email to the selected records... Now i simply want to to display all those records with their Employee code for which an Email has been sent sucessfully...Pls Help... below is my JS code:




var recordsSelected = {!GETRECORDIDS( $ObjectType.RMG_Employee_Master__c)};


if (recordsSelected.length < 1)
  alert('Please select atleast one recrod');
else if(confirm('Are you sure to send email to the selected records?'))
        for (var j=0; j< recordsSelected.length; j++)


               var result = sforce.connection.query('select Email_Address__c, EmpCode__c,Name,Send_Email__c  from RMG_Employee_Master__c    where id = '+"'" +recordsSelected[j] + "'");

              var employee = new sforce.SObject("RMG_Employee_Master__c");
              employee.Id = recordsSelected[j];
              employee.Send_Email__c = 'True';
              result = sforce.connection.update([employee]);

              employee.Send_Email__c = 'False';
              result = sforce.connection.update([employee]);

// i have tried using this code to achieve the same.. but its giving me undefined........
var myarray=new Array();