Question
Could you please advise on how to pass user IDs considering their role for notificationSend
? Currently, it works based on listCreate
:
a1=: if(condition: #application_status = 2; then: $znotif)
znotif: notificationSend(users: $list_users; title: "Application for calculation"; ntf: str`"Application for calculation created" ++ "№" ++ #cycle_number ++ $zstatus`)
//User IDs
list_users: listCreate(item: 14; item: 13)
//change ID to value for status
zstatus: select(table: 'status'; field: 'application_status'; where: 'id' = #idstatus)
I would like to simply specify the "Role" without indicating user IDs, so that notifications are received by users assigned a specific role.
Answer
Select users with the required role from the users table using selectList:
a1=: if(condition: #application_status = 2; then: $znotif)
znotif: notificationSend(users: $list_users; title: "Application for calculation"; ntf: str`"Application for calculation created" ++ "№" ++ #cycle_number ++ $zstatus`)
//User IDs
list_users: selectList(table: 'users'; field: 'id'; where: 'roles' = 3)
//change ID to value for status
zstatus: select(table: 'status'; field: 'application_status'; where: 'id' = #idstatus)