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
RAHUL KARMAKARRAHUL KARMAKAR 

Does anyone knows the solution?

Employee is a custom object on which below fields are to be created : 
Emp ID
Emp Email
Emp User  ( User Lookup )
Profile 
Role 
Designation 
Manager 
Last Logged In
IsActive

When a new employee record is created the following should be checked : 
1.    There should be no other employee associated with the same user as in the Emp User field
2.    If no User is provided ( blank ) then a new internal user record should be created “Salesforce License” and the user mandatory fields should get auto populated based on the above values. 
3.    If an InActive User is provided then only if the email id of the employee record and the user record match, the user record should be made active after employee record creation.

When an existing employee record is updated the following actions should be performed : 
1.    Update the user record if there is any change in Email, Role, Profile fields 

When an existing employee record is deleted or marked as InActive the following actions should be performed : 
1.    Mask the employee record email id
2.    De-activate the associated user record 
3.    Mask the user record email id with “_inactive” suffix

Write bulkified code for all the above tasks.