You need to sign in to do that
Don't have an account?
Home Page Components
Hi,
I am developing a side bar, HTML home page component, where I have to query user records.
Here is my code :
<script scr="../../soap/ajax/26.0/connection.js" type="text/javascript">
</script>
<script>
function showUsers(){ result = sforce.connection.query("Select Name, Id from User limit 1"); records = result.getArray("records"); for (var i=0; i< records.length; i++) { var record = records[i]; console.log(record.Name + " -- " + record.Id); } }
</script> <input type="button" value="Click Me" onclick="showUsers();">
I am getting the following error when I click the button.
Uncaught {faultcode:'sf:INVALID_SESSION_ID', faultstring:'INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session', detail:{UnexpectedErrorFault:{exceptionCode:'INVALID_SESSION_ID', exceptionMessage:'Invalid Session ID found in SessionHeader: Illegal Session', }, }, }
I am trying the above code in a sandbox. To my wonder, the same code works in another development instance.
Could anyone explain what is the reason and a fix for this?
Thanks in advance.