Dynamics CRM4 eService - How to find a contacts Portal User Name

Mar 27, 2009 at 5:39 PM

I'm new to Dynamics CRM, and came across this great plug-in for eServices.
The one thing I'm missing is how to find a contact eService Portal user name.

e.g. a new contact creates an account in the web service portal, two weeks later they call in saying "Hey I forgot my User Name for my account. Can you tell me what it is?"

How can I go about adding this filed to the Contacts form? I can add the field "Web User" Yes/No, but I don't see any attributes for the Contacts Portal User Name.
If I can't add this filed to the form, are their any other methods of getting this information?

Any help would be much appreciated.

Apr 1, 2009 at 9:50 PM
Hi there,
I'm not sure I understand what you're trying to achieve, since displaying the username requires the user to be logged in and if he/she forgot his her username .....

In any case, the username is stored in the sql db you set up as part of the solution (Step 1: ASP.Net Membership).
One way (of a couple of dozen) to retrieve it is this way:
Put this function in the code of the page
protected string GetUserName()
MembershipUser user = Membership.GetUser();
return user.UserName;

and call it either through code or in html using <%= GetUserName() %>

Hope this helps ..
Rgds -Marcus.