I want to capture in the API Before Save Script if a user is being related to a specific Team. If so, I want to throw a recordService\throwForbidden error.
When I relate a User to a Team, then this API call is created:
api/v1/Team/65aec3d57181bc2f7/users
The body of the call is:
{
"ids": [
"6050a05e919a9f3de"
]
}
However, when I create an API before save script on the Entity Team, that checks if the id of the team is a specific ID, then it's not being triggered.
If I update for instance the description field of the Team, then it's triggered.
Is the relate action not caught by the Team entity API before save script?
I thought about using the API before save script of the Entity User, but then I don't know what Team the user being attempted to be added to. I can only retrieve all teamIds. That's not sufficient.
Is there another way to catch this event and throw an error?
When I relate a User to a Team, then this API call is created:
api/v1/Team/65aec3d57181bc2f7/users
The body of the call is:
{
"ids": [
"6050a05e919a9f3de"
]
}
However, when I create an API before save script on the Entity Team, that checks if the id of the team is a specific ID, then it's not being triggered.
If I update for instance the description field of the Team, then it's triggered.
Is the relate action not caught by the Team entity API before save script?
I thought about using the API before save script of the Entity User, but then I don't know what Team the user being attempted to be added to. I can only retrieve all teamIds. That's not sufficient.
Is there another way to catch this event and throw an error?
Comment