Possibility to set user preferences programatically

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mfuermann
    Junior Member
    • May 2021
    • 5

    Possibility to set user preferences programatically

    I'd like to update details in our users preferences programmatically.
    e.g. I'd like to update the email signature with correct contact data in corporate style or containing info on upcoming events.

    I tried to do so by using an API user. But I can't find an option to allow global access to /v1/Preferences/USERID.
    Is there some way to make this possible?
    Is there another way to automate updates of users preferences like mailsignatures?
  • yuri
    Member
    • Mar 2014
    • 8455

    #2
    Admin access required to update preferences of different users. API users don't have such access.

    You can write a custom API action that updates preferences. It can be done using the entityManager, entity type 'Preferences', ids of records are same as corresponding user ids.

    You also need to apply access checking in your code, so that regular users could not access it. You can just check the current user type, whether it's an api-user.
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    Working...