Link to home
Start Free TrialLog in
Avatar of Markdickens2010
Markdickens2010Flag for Australia

asked on

How to get the current user name in Dynamics CRM 2011

Hi Guys,

How to get the current user name (the user who is logged in) in Dynamics CRM 2011.  I want to display the current user name as default in a users lookup.

Your answer is appreciated.

MDickens
Avatar of Chinmay Patel
Chinmay Patel
Flag of India image

Hi MDickens ,

Could you be more specific like where would this lookup going to be?
In ASP.net page? in a static html page that is being hosted inside CRM? A WPF/WinForm app? or anything else?

If it is CRM's built in lookup then no it is not possible to do so in the lookup dialog. If you want to do it in a lookup field then yes you can do it via JS.

Regards,
Chinmay.
Avatar of Markdickens2010

ASKER

Hi Chinmay,

Thank you for your comment.  It is going to be in CRM 2011 lookup.  I have a field called sales representative.  (CRM user are my sales representatives).  I want to  display the User who is logged in in the lookup field, which can be overwritten if the support team are entering the data.  Can you guide with the JavaScript ?  

Regards,

MDickens
ASKER CERTIFIED SOLUTION
Avatar of Markdickens2010
Markdickens2010
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi MDickens,

I would strongly recommend to download and use CRM SDK if you are new to development on CRM. You can find the link at : http://www.microsoft.com/en-us/download/details.aspx?id=24004.

From the SDK find the article: Perform Basic Data Operations in Microsoft Dynamics CRM Using the REST Endpoint. You can bing this topic and find the article online but I will recommend using the SDK URL I have provided above.

Once you go through that article and references given in that article you will have fair understanding of how to complete your activity.

Basically you will add Json2.js to your CRM form and then on Form Load event you will set the current user.

Good luck.

Regards,
Chinmay,
Hi Chinmay,

I am already using CRM 2011 SDK but problem was jscript editor in Dynamics CRM 2011.  I used Visual Studio 2010 and edit the script and it is working fine now.  Thank you for your support.
Fair Enough... Glad I could help.
I found the solution