You need to sign in to do that
Don't have an account?
disturbed118
Getting the ajax toolkit to work in a homepage component
Hi guys i am trying to use the ajax toolkit in a homepage component, the problem is i have to login to get a session is there anyway i can do this without logging in. I have created an html area and added the following code:
<html> <head> <script src="/soap/ajax/16.0/connection.js" type="text/javascript"></script> <script type="text/javascript"> function ShowUser(){ //sforce.connection.login("**************8", "********"); //sforce.connection.sessionId = '{!$Api.Session_ID}'; //var user = sforce.connection.getUserInfo(); alert(document.cookie); } window.onload = ShowUser(); </script> </head> <body> </body> </html>
But if i do not login it won't work?
You have what you need right there but it's commented out. Is this not working for you?
Nope it does not work if i use
sforce.connection.sessionId = '{!$Api.Session_ID}';
it does not work because {!$Api.Session_ID} is null, remember i am doing this in the html area component for home? Can anyone try this out for me thanks
Perhaps you should try grabbing the sessionId directly from the sid cookie. That might work...
Hi
Were you able to resolve this problem? Please share as I am stuck at exactly the same requirement, i.e. I want the session Id in the home page component.
Thanks in advance