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
Deepika Gupta 26Deepika Gupta 26 

Permission set assignment to the login user

Hi,
Stuck in one requirement.in which at the time of create and update account one trgger has to be fired which will call class where i have to comapre login user with account's field that is Keymanager if success then need to assign a specfic permission set to the user.suppose there is 10-15 records where keymanager matches with login id then all have to have that permission like read,write and edit.need inputs
Abu HashimAbu Hashim
@Deepika, 

Did u already tried this as code ?? If so, can u please post the sample code, so that we can look through!!
Deepika Gupta 26Deepika Gupta 26
Abu,
I am new to the apex development thats why not able to move further : to the next step :

Muy Understaning is i have create a account trigger called trigger factory in which in insertupdate method is defined where i can write if(login id==keymanager) but i am not able to use userinfo.getuserid function properly.
Ravi Dutt SharmaRavi Dutt Sharma
Hey Deepika,

What type of field is keymanager on account? Is it a lookup to user?
Deepika Gupta 26Deepika Gupta 26
yes.its lookup to user