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
medemazamedemaza 

How I can get Id from list view

How I can get Id from list view when Icheck box and click Add to call List  I  have vf page but don't know how I can get ID from list

Contact List View

 

Best Answer chosen by Admin (Salesforce Developers) 
vhanson222vhanson222

I ran in to this problem a while back as well.  You need to use Ajax in your "Add to call list" javascript button to invoke your apex class.  Specifically, you will use the 'GETRECORDIDS' function to get the ids of the selected records.  I'm not sure exactly what you are trying to accomplish, but i've included some code that may help get you started.

 

Also, check out this link: AJAX toolkit

 

 

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

sforce.connection.sessionId = "{!$Api.Session_ID}";
// get the selected record ids
records= {!GETRECORDIDS($ObjectType.Widget)};
if (records[0] == null)
{
    alert("Please select at least one Widget");
} else
{ 
    
    var result = sforce.apex.execute("WidgetController","UpdateWidgets",{widget_ids:records,unlockFields:'LockedBy'});

var resultString = String(result);

// after our changes have been made, refresh the enhanced list on the page
ListViewport.instances['j_id0:enhancedWidgetList'].refreshList()

}