function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mark TMmark TM 

Help with Trigger

Hi

 

 

I want to write a trigger for giving permissions only to 2 users based on the record type and channel in account , Please guide me how to do this.

 

 

Thanks

gbrowngbrown

A better approach would be to allow access to the record type and building a seperate page layout instead of writing a trigger.

gbu.varungbu.varun

You can find current user id userinfo.getUserId() . Now you can check any criteria that this user  fullfill or not.

 

 

For example:

 

trigger LeadTrigger on Lead (after insert, after update) {

  ID id = userinfo.getUserId() 

  USER u = [Select id,name from User where id=:id];

    if(u.name==''Desired USer'){

       // Write trigger code.

    }

}

digamber.prasaddigamber.prasad

Hi,

 

I think you are talking about giving access to couple of users using sharing access records. If yes, let me know, I can help you on this.

 

Regards,

Digamber Prasad