function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SFDC developer55SFDC developer55 

locale value from user object

I need to get the value of Locale from user object using javascript.  Could you please help me on this?   Locale image from User Object 

Regards,
Paddy
Satish_SFDCSatish_SFDC
You can use the Ajax toolkit for this requirement.

I found a post in stackoverflow which could help you.
http://salesforce.stackexchange.com/questions/14119/how-to-get-the-role-of-the-currently-logged-in-user

You could use the following code, use Locale instead of profileid.

<script type="text/javascript" src="/soap/ajax/27.0/connection.js"></script>
<script type="text/javascript">
  var sid = getCookie('sid');
  var server = "https://" + window.location.host + "/services/Soap/u/27.0";
      //initiate the connection
  sforce.connection.init(sid, server);

  var currentUser = sforce.connection.getUserInfo();
  alert('the profile Id is '+ currentUser.profileId);
  var result = sforce.connection.query('select name from profile where id=\''+currentUser.profileId+'\'');
  var arrayResults = result.getArray("records");
  alert('the name of the profile is '+ arrayResults[0].Name);

</script>

Hope this helps.

Regards,
Satish Kumar
SFDC developer55SFDC developer55
Satish,

I am getting the below error:
SCRIPT5022: {faultcode:'sf:INVALID_SESSION_ID', faultstring:'INVALID_SESSION_ID: Invalid

Thank you for your reply.

Regards,
Paddy
Satish_SFDCSatish_SFDC
Can you post your code here?

Regards,
Satish Kumar