Workflow: Add User to Role

Hi, how do I add a user to a role in a workflow? I assumed there might be a built in function for this but it seems there isn’t.

First I tried using the “Update Record” node but I’m not sure how I use this to append a new role as well as keeping the existing roles of the user.

Then I thought I’d use a HTTP node and call the API. With this I can successfully add and remove roles however the user doesn’t see the new routes until they log out and in again. When doing it via the admin interface the user then only needs to refresh the browser to see the new routes.

Is there a better way to do this or a way to update whatever cache is not refreshing for the user when adding the role via the API?

Hello, you must log in again or refresh your browser for your user’s role and permission information to be displayed in the browser.

Thank you. From my testing when adding via the API the user has to log out and in again. When adding manually via the admin interface they only have to refresh.

Is there any way to make the API call have the same result as manually doing it?