Dear Experts,
I have the following requirement.
Scenario: A user wants to create a task which is regarding to an opportunity, the opportunity is linked to a custom entity called management team. The management team has a field which is a lookup field called "Team Member" which is related to user entity.
Now i want to check whether the user who is creating the task for the opportunity is a part of the management team in the opportunity. If yes then the user is allowed to move on and save the task, otherwise the user should be prompted and not allowed to create a task for that opportunity. i cannot do this from a security roles because the user is not the owner or creator of the opportunity but is a part of the opportunity which is linked with a custom entity as mentioned above.
I am looking for a solution with javascript, i have done this before with 2 linked entities for example i can get values from the linked opportunities, but how can i access the management team (Custom Entity) attributes from the task form as they are not linked directly but rather from the opportunity entity.
If i could access the user in the custom entity i can compare the creator of the task with the team member of the custom entity.
Please provide a solution.