You need to sign in to do that
Don't have an account?
Apex Code Development
How to retrieve userRoleId using Ajax in javascript?
Hii Folks!!!!
I'm working on Professional Edition.I need to retrieve userRoleId of the user who logs in to the system.
I'm getting username,userId,profileId and sessionId correctly through the following code:
var user = sforce.connection.getUserInfo();
alert(user.userName);
alert(user.Id);
alert(user.profileId);
alert(user.sessionId);
But could not retrieve "userRoleId".Can anyone suggest me with a solution.
Thanks & Regards,
Jagadeesh K.
Tryout the sample code given below :
<apex:page >
<script src="/soap/ajax/19.0/connection.js" type="text/javascript"></script>
<script src="/js/functions.js"></script>
<script src="/soap/ajax/19.0/apex.js" type="text/javascript"></script>
<script>
function GETINFO()
{
sforce.connection.sessionId="{!$Api.Session_ID}";
var user = sforce.connection.getUserInfo();
alert(user.userName);
alert(user.roleId);
alert(user.userId);
alert(user.profileId);
}
</script>
<script>
{
window.onload=GETINFO();
}
</script>
</apex:page>
Hope this helps.
All Answers
Tryout the sample code given below :
<apex:page >
<script src="/soap/ajax/19.0/connection.js" type="text/javascript"></script>
<script src="/js/functions.js"></script>
<script src="/soap/ajax/19.0/apex.js" type="text/javascript"></script>
<script>
function GETINFO()
{
sforce.connection.sessionId="{!$Api.Session_ID}";
var user = sforce.connection.getUserInfo();
alert(user.userName);
alert(user.roleId);
alert(user.userId);
alert(user.profileId);
}
</script>
<script>
{
window.onload=GETINFO();
}
</script>
</apex:page>
Hope this helps.
Yes....It worked
Thanks a lot Pradeep for your quick solution.
Regards,
Jagadeesh K.