I have a requirement like, need to select multiple records on the list view. After done with the selection of records. If I click the List view custom button, those selected records must be created into another object. Its similar kind of LEAD Conversion button but I need for Bulk Conversion. DO any one have sample codes or logic for this requirement. I also viewed the below page, its some what similar. But I don't need to have a VF page.
Creating a custom list-view button that handles multi-record selection
Looping : https://salesforce.stackexchange.com/users/286/andrew-fawcett
EDIT: My Code.. I am started to learn doing coding. So please bare my mistakes in codes. Now the problem in Code is : In Destination object records are not created. The selected source object records should be created in destination record, after clicking the button. All the field values need to be captured dynamically. But I am not able to get the result...
{!REQUIRESCRIPT("/soap/ajax/26.0/connection.js")}
var url = parent.location.href;
var records = {!GETRECORDIDS($ObjectType.SourceObject__c)};
var newRecords = [];
if (records[0] == null)
{
alert("Please select at least one record to create.");
}
else
{
for (var a=0; a<records.length; a++)
{
var newDestinationrecords = new sforce.SObject("DestinationObject__c");
newDestinationrecords.id = records[a];
newDestinationrecords.test__c = 'test'; // Hard code data
newRecords.push(newDestinationrecords);
}
result = sforce.connection.create(newRecords);
parent.location.href = url;
}
Thank you for your response.. Regards Syed