To set team access from an expression it requires the usage of the Team field and a selection list. This method works by creating a selection list with the names of all the teams you want to use. Then by creating a team field which obtains its value from an expression where it uses an if statement to return a team ID from the selection list. Once the value of the team has been selected a workflow would then be triggered to set the access rights for the team. This method must be kept up to date by an app builder, so if a new team is added a builder would need to add it to the expression and selection list.
To start we would first need to create a selection list and add the teams we want use for the app then click on Save.
Once that’s completed go onto the app and create a Selection field and use the selection list we have just created.
Then add a team field which we will use in our workflow.
Then under the expressions we will use an if statement which you can find out more here.
Finding Team Information
The expression will work by obtaining the ID from the teams app which is found on the grid icon at the top left of the site then by clicking onto the gear button so that the team app becomes visible. Once you have entered the team's app you should find the list of teams you want to use and by clicking onto the record you can find their ID.
Adding the Expression
The expression should look like the expression in the image below by using an if statement to find if the Team selection field is equal to its ID.
if([Team] = 'Demo', '615569c806b3894dd965d6bb', if([Team] = 'Test', '613f4e9f0334b915f426756b', ''))
Then add the selection field to the template to allow users of the site to select the teams.
Now comes the part where we add the workflows in which you go onto the Workflow V2 menu and click on Add which should take you to a page like the image below and give it a description to indicate what it’s purpose. If you are not familiar with Workflow V2 or would like to learn more about it you can find it here.
For the trigger node we will need to create multiple workflows for when a field is updated or if a record is created in this example field updated is used.
After the trigger node, a filter node is created to add some requirements to the workflow so a requirement used could be if the Team field is not empty.
Finally, comes the action node where the node type would need to be Update Record. The action for this node can then be to set ReadOnly access rights or to set full access rights but choose which ever works best for your site and select the Team field in the Target Team Field section, and now the workflow is complete. Which by then another similar workflow is needed but for the other trigger node which would be record create in this example.
Should both workflows be completed the workflow page should look similar to the image below and you can begin testing the workflow.
Once you have resynced the app hopefully now if you select a team from the selection list if should update the record access rights for the team.
Please sign in to leave a comment.