+ Start a Discussion
okmiokmi 

Apex Values in Customer Portal Header?

I'm just starting out in SF, and don't have a lot of development experience. We have a customer portal that was recently developed, and I need to tweak it a bit to output the current user's main account name in the header of the portal. As far as I can tell I can only upload a static HTML file via the Documents section of our instance. Is that correct? How would I pull in a dynamic value to that section of our portal?

Best Answer chosen by Admin (Salesforce Developers) 
Pradeep_NavatarPradeep_Navatar

Yocan create a visual force page and wraps the page in an iframe :

 

<IFRAME height=120 src="/apex/HOC__Home_Page_Dashboard" frameBorder=0 width=170></IFRAME>

 

where Home_Page_Dashboard is the visual force page. Put that iframe in home page sidebar components. In apex page you can use SOQL to access the current user's account name :

 

user u =[select id,contactid where id=:userinfo.getuserid() ];

contact con = [select id,account.name from contact where id=:u.contactid];

 

Hope this helps.

All Answers

Pradeep_NavatarPradeep_Navatar

Yocan create a visual force page and wraps the page in an iframe :

 

<IFRAME height=120 src="/apex/HOC__Home_Page_Dashboard" frameBorder=0 width=170></IFRAME>

 

where Home_Page_Dashboard is the visual force page. Put that iframe in home page sidebar components. In apex page you can use SOQL to access the current user's account name :

 

user u =[select id,contactid where id=:userinfo.getuserid() ];

contact con = [select id,account.name from contact where id=:u.contactid];

 

Hope this helps.

This was selected as the best answer
okmiokmi

that is actually exactly what I ended up doing, and it worked very well. Thanks!

dev33dev33

hi okmi,

 

I want to dispay user's name on the custom portal html header (customized html). Could you please elaborate on how would I be able to do that?

 

Thanks!

vgandla@60demo.comvgandla@60demo.com

Hi okmi,

 

Me also got same kind of requirement, displaying the logged in user name on top of header with customized html. Did you have any solution for this please let me know.

Sivapriya RajeshwerSivapriya Rajeshwer
I have gotten the same requirement to fetch the current user's firstname and lastname in the HTML header. I was able to pull user's email using UserContext.userName. Anyone has any suggestions on how to pull the fistname and lastname?