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

How to write Java Script SOQLwhere query ?
I am working with list view , after fetching id's i want to access that record using those id's , so what will be query .?
{!REQUIRESCRIPT("/soap/ajax/21.0/connection.js")}
var records = {!GETRECORDIDS($ObjectType.student__c)};
{!REQUIRESCRIPT("/soap/ajax/21.0/connection.js")}
var records = {!GETRECORDIDS($ObjectType.student__c)};
Just you have try this code:
{!RequireScript("/js/functions.js")}
var recordsSelected = {!GetRecordIds($ObjectType.student__c)}
for(var i=0; i < recordsSelected .length ; i++) {
alert('Selected ID. '+recordsSelected[i]);
}
Thanks,
kathir.
{!REQUIRESCRIPT("/soap/ajax/31.0/connection.js")}
var a="{!Location__c.Id}";
var strQuery="SELECT Id FROM Promo_Material_Snapshot__c where Location__c =\'"+ a + "\' limit 1";
var result = sforce.connection.query(strQuery);
Hope you'll be able to modify above code according your need.
var records = {!GETRECORDIDS($ObjectType.student__c)};
for(var i=0 ; i<records.length ; i++){
var query = "SELECT city__c from student__c where id= \'"+ records[i] + "\'";
var record = sforce.connection.query(query);
alert('this is msg'+record.city__c);
}
As this is not working when I remove the Namespace from the Field and Object which is Deepak_Shyoran so use full name with namespace.
------------------------------------------------
{!REQUIRESCRIPT("/soap/ajax/31.0/connection.js")}
var strQuery="SELECT Id,city__c FROM Student__c where city__c ='kota'";
var result = sforce.connection.query(strQuery);
var records = result.get('records') ;
console.log('----'+result);
console.log('--rec-'+records ) ;
for(var i=0 ; i<records.length ; i++){
alert('this is msg---'+records[i].city__c );
}
You try this code i hope you get id....
{!REQUIRESCRIPT("/soap/ajax/31.0/connection.js")}
var strQuery="SELECT Id,city__c FROM Candidate__c where city__c ='kota'";
{!RequireScript("/js/functions.js")}
var recordsSelected = {!GetRecordIds($ObjectType.student__c)}
for(var i=0; i < recordsSelected .length ; i++) {
alert('Selected ID. '+recordsSelected[i]);
}
Thanks,
kathir
Just change your object name....
{!REQUIRESCRIPT("/soap/ajax/31.0/connection.js")}
var strQuery="SELECT Id,city__c FROM student__c where city__c ='kota'";
{!RequireScript("/js/functions.js")}
var recordsSelected = {!GetRecordIds($ObjectType.student__c)}
for(var i=0; i < recordsSelected .length ; i++) {
alert('Selected ID. '+recordsSelected[i]);
}
thanks,
kathir
Which obj u want to be delete just the object name....
Code:
{!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")}
var idsToDelete = {!GETRECORDIDS( $ObjectType.Lead)};
var deleteWarning= 'Are you sure you wish to delete ' +idsToDelete.length+ ' Records?';
if(idsToDelete.length&& (window.confirm(deleteWarning)))
{
sforce.connection.deleteIds(idsToDelete,function()
{navigateToUrl(window.location.href);
});
}
else if (idsToDelete.length == 0)
{
alert("Please select the leads you wish to delete.!!");
}
Thanks,
kathir
Select the check box menas which record you want to delete....
Thanks