+ Start a Discussion
Jerun JoseJerun Jose 

Current User Details in Home Page Component

Hi,

 

I have a narrow home page component which contains javascript in a HTML area section.

I'm looking for a way to get the current user details in this javascript. I need this to identify the current user's profile ID and perform some DOM manipulation. I have the code for performing the DOM manipulation. I am not able to however get the current user details. The normal merge field approach of {!$User.ID} does not work.

 

<script>
	var usr = // some way to get the current user ID.
</script>

 Any help is appreciated.

 

 

ReidCReidC

Create a VF page that displays the info you wanbt.

Create a home page component, HTML area, with and iframe linking to the VF page.

Might make DOM manipulation difficult.

Jerun JoseJerun Jose
Thanks Reid, but I am trying to hide a button on the UI depending on the current user's profile. Using a VF page would induce cross domain issue, so I dont know how I can use the VF page to help me with the DOM manipulation.
Patcs_1Patcs_1

Hi Jerun

 

do you find any solution for this issue?

 

Thanks in advance!!!

 

Patcs_1Patcs_1
Hi Jerun



do you find any solution for this issue?



Thanks in advance!!!
Jerun JoseJerun Jose

I did not do it in that project, but I guess what you could do would be to call an apex class method using javascript using the apex.execute command.

 

The apex method can then retreive the logged in user details for you and return that back to the javascript code.