How to use a formula to send a notification to current workspace admins

I really appreciated the script from the hide spaces forum discussion, and now I want to create an automatic reminder for admins to run this rule whenever a new user is added to the workspace. I assumed it would be fairly straightforward, with the “TO” section of the rule having the formula:

Users.Filter([User Role] = "Admin")

However, Fibery says “Reference to undefined variable User Role”. Am I missing something?

What do you mean by ‘the “TO” section’ ?

Sorry, I meant “To”, so the section within a “Notify Users” rule for the recipient of the notification.

Have you considered just automatically running the re-ordering rule whenever a new user is added (and picking an Admin to copy)?

I wasn’t feeling very confident in modifying the script, but perhaps you can confirm the appropriate change. Would the only change be to replace “args.currentUser[‘Id’]” with the ID number of the relevant user (e.g. 2)?

I was also wanting to “future proof” this in a way in case the admin changes, though perhaps this doesn’t matter as long as the user stays within the system so that their sidebar ranking (even if not an admin) continues to be copied.

Almost. You need the UUID of the relevant user (which you can get by pressing Alt when hovering over the public id).
image

Indeed, it shouldn’t matter as long as that user exists.

1 Like

Ok, hopefully final clarifying question (I’m not THAT familiar with scripting other than BASH). The UUID should go in there with single quotes around it, right? So that it should look like this?

const userToCopy = await fibery.getEntityById(entity.type,'ccdc1640-a8d9-11ef-a9c2-95456d5d9e32', ['fibery/menu-rank']);
1 Like