// profile properties that are pulled in from active user var thisUsersID; var thisUsersCustomPostalCode; // hardcoded values for testing var zipPropName = "UserPostalCode"; var zipPropValue = "12345"; $(document).ready(function() { getUserProfileProperties(); alert(thisUsersCustomPostalCode); $(".pp-ButtonWrap").append("<span class='gaView'><a href='#' onclick='modUserZip(thisUsersID, zipPropValue)'>Update Zip</a></span>" ); }); //Start user profile property update function function modUserZip(thisUsersID, zipPropValue){ var propertyData = "<PropertyData>" + "<IsPrivacyChanged>false</IsPrivacyChanged>" + "<IsValueChanged>true</IsValueChanged>" + "<Name>UserPostalCode</Name>" + "<Privacy>Public</Privacy>" + "<Values>" + "<ValueData>" + "<Value xsi:type=\"xsd:string\">" + zipPropValue + "</Value>" + "</ValueData>" + "</Values>" + "</PropertyData>"; alert(propertyData); $().SPServices({ operation: "ModifyUserPropertyByAccountName", async: false, //webURL: "/_vti_bin/UserProfileService.asmx", accountName: thisUsersID, newData: propertyData, completefunc: function (xData, Status) { var result = $(xData.responseXML); alert("wierd one" + result); alert(thisUsersTest); } }); alert("UserPostalCode = " + thisUsersCustomPostalCode); } //get various profile properties of current users function getUserProfileProperties() { thisUsersID = $().SPServices.SPGetCurrentUser({fieldName: "ID"}); thisUsersCustomPostalCode = $().SPServices.SPGetCurrentUser({fieldName: "UserPostalCode"}); };
It's a simple example but it fails.
A few things to note is that at the "weird one" alert, I'm getting back an [object] [object] value.
I also thought it may have to do with the fact that I'm using a custom user profile property instead of an out of the box one; not the case. It's busted with both.
Any thoughts or suggestions?