Hi! Is there a way to give permissions to a role w...
# dev-ops
e
Hi! Is there a way to give permissions to a role with a script? I can see all permissions with
SELECT * FROM rolePermissions WHERE role = 3
But can I also add permissions to a role?
m
You should be able to load a role using record.load and adjust them
e
I was not able to with
record.Type.ROLE_PERMISSIONS
m
Copy code
const roleRecord = record.load({
                            type: 'role',
                            id: roleId,
                            isDynamic: true,
                        });
We utilize this to make implementations easier. We then go through and update permissions according. What error did you receive?
e
Oh. I might have used the wrong type
Do you then set the field
permissions
to add a permissions to that role?
m
You’ll have to loop through the sublists and set the according permission and level
e
Thanks 👍 I will try