You need to sign in to do that
Don't have an account?
Mittop
I feel like I am being stupid, but I can't get the UserID of the current User in the S-Control
Need a hand with this one. I am trying to use the API Utility call in Javascript to get the Current User ID.
I have been using some test code just to get a result, and it keeps saying undefined. I have tried the following.
function initPage() {
sforceClient.init("{!API_Session_ID}", "{!API_Partner_Server_URL_70}", false);
var uInfo = sforceClient.GetUserInfo();
alert(uInfo.getUserId()));
loadPage();
}
function initPage() {
sforceClient.init("{!API_Session_ID}", "{!API_Partner_Server_URL_70}", false);
var uInfo = sforceClient.GetUserInfo();
alert(uInfo.getUserId);
loadPage();
}
function initPage() {
sforceClient.init("{!API_Session_ID}", "{!API_Partner_Server_URL_70}", false);
var uInfo = sforceClient.GetUserInfo();
alert(uInfo.get("userID"));
loadPage();
}
None of these work. What am I missing? Anyone point me in the right direction?
Thanks!
Mittop
I have been using some test code just to get a result, and it keeps saying undefined. I have tried the following.
function initPage() {
sforceClient.init("{!API_Session_ID}", "{!API_Partner_Server_URL_70}", false);
var uInfo = sforceClient.GetUserInfo();
alert(uInfo.getUserId()));
loadPage();
}
function initPage() {
sforceClient.init("{!API_Session_ID}", "{!API_Partner_Server_URL_70}", false);
var uInfo = sforceClient.GetUserInfo();
alert(uInfo.getUserId);
loadPage();
}
function initPage() {
sforceClient.init("{!API_Session_ID}", "{!API_Partner_Server_URL_70}", false);
var uInfo = sforceClient.GetUserInfo();
alert(uInfo.get("userID"));
loadPage();
}
None of these work. What am I missing? Anyone point me in the right direction?
Thanks!
Mittop
Is there a post anywhere with a list of which merge fields are included to access in the s-control?
Thanks for your help!
Mittop
Just curious, what was I doing wrong calling the GetUserInfo function?
Look at sforceclient_beta3.3.js. In it you will see that functions and Javascript are case-sensitive. Thus you need to use "getUserInfo", not "GetUserInfo". Here is the code you can use to replace what you have to inspect the fields from the UserInfoResult:
Code:
Thanks!
Mittop