You need to sign in to do that
Don't have an account?

Need an Opportunity object trigger
Hello,
I have a new record type called Competitive Opportunities in the Opportunities object. I am looking to create a trigger that allows only the users in a specific Role (Global Users) or with a specific Profile (Global Permissions) to be able to access and complete the record.
For users in other profiles, an error message should pop up indicating that they do not have the correct permissions to access the record.
Also, any records of the Competitive Opportunities type should only be visible in a search to the Global Users or Global Permissions role or profile.
Please advise.
I have a new record type called Competitive Opportunities in the Opportunities object. I am looking to create a trigger that allows only the users in a specific Role (Global Users) or with a specific Profile (Global Permissions) to be able to access and complete the record.
For users in other profiles, an error message should pop up indicating that they do not have the correct permissions to access the record.
Also, any records of the Competitive Opportunities type should only be visible in a search to the Global Users or Global Permissions role or profile.
Please advise.
With regards to roles, again, it might be easier to create permission sets that mirror the roles to use the built in support.
In a trigger you could check the UserInfo.getUserRoleId() to get the users roles. Compare this value for each record being inserted with the allowed roles and then use sObject.addError() to reject invalid records.