For example, i have a simple JS button which returns the username of the logged in user.
{!REQUIRESCRIPT("/soap/ajax/25.0/connection.js")}
var name= sforce.connection.getUserInfo();
alert( name.userName);
This works perfectly fine when in salesforce but, returns an error when clicked from Customer Portal. Am i missing something?
Usecase is that i am trying to get some CP user details to display on an HTML area. Any thoughts?
Update: I got the button to work (changed it to v25.0 from 20.0- my bad) but the same JS in cpheader or HTML sidebar component gives below message :(
Error:
Refused to set unsafe header "User-Agent" POST https://mysite.com/pkb/services/Soap/u/25.0 500 (Internal Server Error) connection.js:599 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', }, }, } connection.js:1019
thanks