How do you save to a user's Profile Fields using the Rest API?

Former Member
Former Member

I have the following code in my ui.js file, but it is not saving as expected. I am using the line following line to save to the user's profile field.

data.ProfileFields['AccountType'] = $('input:checked', $(context.accountType)).val();
:

Here's more of the code:

    _saveUser = function(context) {
        var data = {
            UserId : context.userId
        };

        if ($(context.accountType).length > 0)
        {
            data.ProfileFields['AccountType'] = $('input:checked', $(context.accountType)).val();
        }

        return $.telligent.evolution.put({
            url: $.telligent.evolution.site.getBaseUrl() + 'api.ashx/v2/users/{UserId}.json?IncludeFields=User.Id',
            data: data,
            dataType: 'json',
            defaultErrorMessage: context.saveErrorText,
            success: function(response) {
                $.telligent.evolution.notifications.show(response, {type:'success'});
        	}
        });
    },

Also, how do you retrieve the profile field in Velocity? I a trying the following

$user.ProfileFields.get_Item("AccountType").Value