.rTable { display: table; }
<script type="text/javascript"> var __sfdcSessionId = '{!GETSESSIONID()}'; </script> <script src="../../soap/ajax/37.0/connection.js" type="text/javascript"></script> <script type="text/javascript"> window.onload = setupPage; function setupPage() { var state = { //state that you need when the callback is called output : document.getElementById("output"), startTime : new Date().getTime()}; var callback = { onSuccess: layoutResults, onFailure: queryFailed, source: state}; sforce.connection.query( "Select UsersId, UserType,IsCurrent,users.name From AuthSession ", callback);
}
function queryFailed(error, source) {
source.output.innerHTML = “An error has occurred: ” + error;
}
function layoutResults(queryResult, source) {
if (queryResult.size > 0) {
var records = queryResult.getArray(‘records’);
for (var i = 0; i < records.length; i++) {
var user = records[i];
var tr = document.createElement("tr"); tr.innerHTML = '<td>' + user.UsersId + '</td>' + '<td>' + user.UserType + '</td>'+ '<td>' + user.IsCurrent + '</td>'; document.getElementById("myTable").appendChild(tr); } source.output.innerHTML = output; }
}
<html>
Id
Name
iscurrent
i tried to get all the logged in users,,am getting ids ,i also want to display the names.need help to meet this.thanks in advance
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
You can use the following query instead:
select name from user where id in (select usersid from authsession where iscurrent = true)
This will give you a de-duplicated list of all the users with current sessions by name. You can also select any of the other usual User fields.
Alternatively, UsersId is a normal relationship field, so you can also do:
select users.name from authsession where iscurrent = true
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0