Link to home
Start Free TrialLog in
Avatar of sbdt8631

asked on

Dynamics CRM 4.0 Java Code to Get User Name

I thought this would be easy but using Google isn't working for me to find a correct answer.  What code can I put in the OnLoad event of the form that will store the current user name in a variable that I can use in an If statement?
Avatar of Feridun Kadir
Feridun Kadir
Flag of United Kingdom of Great Britain and Northern Ireland image

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


I saw that one but it seems like complete overkill just to get the user name.

This one promised to do it but delivered a generic error.
var cmd = new RemoteCommand("SystemUser", "WhoAmI", "/MSCRMServices/");
var res = cmd.Execute();
if (res.Success)
return res.ReturnValue.UserId;

I found various examples of this but always get System is Undefined
I think remotecommand may be unsupported so I wouldn't go down that route.
Your second link refers to java not javascript.

I don't see that you have any other option.
Thank you