+ Start a Discussion
Sfdc11Sfdc11 

User Info in javascript..URGENT!!!!!

Hi,

 

How to get the loggined User fields in Javascript.can I write SOQL query through connection.js in Homepage components??????

 

eg,$user.email ,but when I tried to alert its not showing..

var userId={!$user.email};
alert('user'+userId);

 

Pls Help me out.......

souvik9086souvik9086

Change like this

 

var userId='{!$user.email}';
alert('user'+userId);

 

If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.

Thanks

Sfdc11Sfdc11
I've tried this also.If I give within quotes that takes it as String as whole and display !$user.email
***********************************************************************************************************
CONFIDENTIALITY NOTICE

This message is for the named person's use only. It may contain confidential, proprietary or legally privileged information.

If you receive this message in error, please immediately delete it and all copies of it from your system, destroy any hard copies of it and notify us by email to email.security@rntbci.com with a copy of this message. You must not, directly or indirectly, use, disclose, distribute, print or copy any part of this message if you are not the intended recipient. RNTBCI and any of its subsidiaries each reserves the right to monitor all e-mail communications through its networks.

RNTBCI is neither liable for the proper, complete transmission of the information contained in this communication nor any delay in its receipt. This email was scanned for the presence of computer viruses. In the unfortunate event of infection RNTBCI does not accept any liability.

Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorised to state them.
***********************************************************************************************************
souvik9086souvik9086

But here it is working fine.

Is this also not working?

 

var userId="{!$user.email}";

 

If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.

Thanks

Avidev9Avidev9
Since you are working with homepage component, the standard merge notation wont work and it will just take it as literal string.

You have to write a class, and invoke the same using connection.js, this way you will be able to get the user detail.

Additionally I am not sure about the requirement, you can always use a VF page that is fetched in Homepage component as a IFRAME