Automation Tasks Help

I could you some assistance with Automation - Tasks to CC a user’s Supervisor when a report is triggered. I have a simple app for completing Juvenile Detention Screens and the app is shared by 9 counties. Each county may have many users, but each county has only one Supervisor. The Supervisors themselves don’t need to have access to the app, just the triggered report. The app has a user table with the following columns: Email, Name, Role, County, Phone Number. Within the Roles column, there are 3 types: Admin, User, and Supervisor. Each Supervisor is listed in the user table, for example:
Email Name Role County Phone Number
somesupervisor@outlook.com, Some Johnson, Supervisor, Stephenson, 555-555-5555
tinasomeone@outlook.com, Tina Turner, User, Stephenson, 555-333-3333

Within Automation - Tasks, when a report is triggered, this is sent to the user who triggered it, i.e. useremail(). Within the Email Content section of the Task, I would like to create an expression that CC’s the triggered report to the users Supervisor, but I’m really struggling to get the expression correct and could use some help.

Thank you in advance for your assistance!

1 Like
ANY( SELECT(
  user[email] ,
  AND(
    [role] = "supervisor" ,
    [county] =   LOOKUP( USEREMAIL() , "user" , "email" , "county" )
  )
) )
2 Likes

Hello and thank you so much, the expression works great! I did write my own, which did seem to work, but may not work as well as yours. What are your thoughts on my version, how might it have failed?

ANY(SELECT(Users[Email],([Role]=“Supervisor”)))

Thanks again!

1 Like

Yours doesn’t have any comparison against the user’s county. It will just pick the first supervisor in the user table.

1 Like

Yep, you’re right. It just so happen that when I tested, it should have gone to the first Supervisor listed in the User table. thanks again for all your help!

2 Likes