get js value from SPService to display in nintex form

  • 9 September 2015
  • 4 replies
  • 3 views

Badge +8

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: ["ID", "FirstName", "LastName"],  

     debug: false

      });

});});

Thank you,

Jennifer


4 replies

Userlevel 5
Badge +9

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 ?

Badge +8

We have enterprise and I want to populate a textbox.

Thank you,

Jennifer

Badge +8

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

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

Thanks,

Jennifer

Userlevel 5
Badge +9

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