Skip to main content

Good Day,

I have the following code and I am trying to get the values and store them into corresponding text boxes.  Any one have any information on how to do that?

NWF$(function () { $(document).ready(function() {

     var thisUsersValues = $().SPServices.SPGetCurrentUser({

     fieldNames: l"ID", "FirstName", "LastName"],  

     debug: false

      });

});});

Thank you,

Jennifer

Which version of SharePoint do you have (Foundation, Standard or Enterprise) ?

If you have the Standard or Enterprise one, you can do it with a calculated value control and the userProfileLookup function.

Do you want to just display those information or do you want to prepropulate text boxes ?


We have enterprise and I want to populate a textbox.

Thank you,

Jennifer


I got it; I need to do this...

NWF$('#' + varFirstName).val(thisUsersValues.FirstName);

Thanks,

Jennifer


That's a possibility.

If you want to get other properties from the user profile, you can use a calculated value to get the information from the user profile using the userProfileLookup function and in the calculated value call your javascript function with the user profile property as a parameter like this :

myJavaScriptFunction(userProfileLookup(Current User,"PreferredName"))

Your javascript function could look like this to populate a textbox control with the parameter :

function myJavaScriptFunction(userProfileProperty) {

     NWF$('#' + controlClientID).val(userProfileProperty);

}

Hope this helps


Reply