You need to sign in to do that
Don't have an account?

Using GETRECORDIDS in javascript
I'm struggling with using GETRECORDIDS in a javascript that is called from an apex command button on a VF page.
Keep getting 'getRecordIds is not defined' when using Firebug
Code is like this:
<script type="text/javascript"> var __sfdcSessionId = '{!GETSESSIONID()}'; </script> <script src="../../soap/ajax/25.0/connection.js" type="text/javascript"></script> <script type="text/javascript" > function massdelete(){ var records = {!GETRECORDIDS($ObjectType.Member__c )};
The HTML for the page shows as:
<script src="../../soap/ajax/25.0/connection.js" type="text/javascript"></script> <script type="text/javascript"> function massdelete(){ var records = getRecordIds('a0B');
Is it possible to use GETRECORDIDS in this way?
Hi,
Try the below code as reference:
{!REQUIRESCRIPT("/soap/ajax/22.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/22.0/apex.js")}
sforce.connection.sessionId="{!$Api.Session_ID}";
var test={!GETRECORDIDS( $ObjectType.Contact )};
try
{
if( test =='')
{
alert("Please select at least one record.") ;
}
else
{
var confermation=confirm("Are you sure want to Delete???")
if(confermation == true)
{
alert('yes');
var result=sforce.connection.deleteIds(test);
//if(result[0].success )
alert(result[0].success);
}
}
var contextUser = sforce.apex.execute("AshishPackage.deleteAshishTestRecords", "deleteRecords", {ids: test });
alert(test);
}
catch(err)
{
alert('error');
alert(err.message);
}
//window.location.reload();
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
Thanks for that.
The code you show is what I am trying to use, but on a VF page, not in the formula for a custom button.
When I try to use REQUIRESCRIPT on the VF page, I get the error:
REQUIRESCRIPT may not be used in this type of formula
Any ideas?
Thanks