+ Start a Discussion
V'NathV'Nath 

Home page Component

how to place query in Homepage Component  . i have writeen Script like below in that i would like to get User information

by using Query or Global Variables but it Doesnt give Result.

please help regards this issue. Advance thaks . 

<script>
var caseviewid;
casviewnone();
function casviewnone(){
caseviewid = document.getElementById('00BU0000002QFJR_filterLinks');
alert('{!$user.firstname}');
var lst = document.getElementsByTagName('a');
for(var i=0; i<lst.length;i++){
if(lst[i].innerHTML == 'Edit' || lst[i].innerHTML == 'Create New View' || lst[i].innerHTML == ' | ' ){
lst[i].style.display = 'none';
}
}
if(caseviewid == null){
setTimeout("casviewnone()", 200);
alert('if');
}else{
document.getElementById('00BU0000002QFJR_filterLinks').style.display='none';
}
}
</script>

 

Alok_NagarroAlok_Nagarro

Hi,

 

You need to use ajax api in homepage component, since in homepage component you can write only javascript &html but not apex. Plz refer below code for reference -

 

{!requireScript("/soap/ajax/24.0/connection.js")}
var result = sforce.connection.query("Select Name, Id from User limit 2");
var records = result.getArray("records");

for (var i=0; i< records.length; i++)
{
var record = records[i];
alert(record.Name + " -- " + record.Id);
}