AnsweredAssumed Answered

Unable to change default_teams preference for user through the API

Question asked by Artis Plocins on Feb 20, 2018

I have created an application-level view that needs to be able to change the user's default teams. When I run the code below from the view or the JS console in Sugar while logged in and reload the page when it's done nothing changes.

 

Method app.user.updatePreferences() can be found in sidecar/src/core/user.js and it wraps app.api.call() to the endpoint me/preferences.

attributes = {
    default_teams: [
        {
            id: '56669e76-6d3e-66c3-cbb1-56aea5de7fb5',
            name: 'Test Team'
        }
    ]
};

app.user.updatePreferences(attributes, function() {
    console.log('Default teams updated.')
});

 

When I test the request through Postman, I can afterwards retrieve the new default_teams, but they never appear under my Profile -> Advanced -> Default Teams in Sugar.

 

Can I only update the default teams by creating a custom endpoint or PHP script that my Sidecar view can call and do it on the User bean?

Outcomes