You need to sign in to do that
Don't have an account?
I have a trigger but need help with a class
I wrote this trigger, with help from the community, to update owner to current user upon status closed. I am in need of a class and don't throughly understand the language yet (taking classes). Does any one know where to start?
trigger CaseUpdate on Case (before update) {
List<User> usersRoleName =[select Id, Name, UserRole.Name from User Where Id=:UserInfo.getUserId() AND UserRole.Name ='Technical Services'];
if (Trigger.new.size() == 1) {
// if a Case has been updated to Closed
if (Trigger.new[0].Status == 'Closed' && !usersRoleName.isEmpty()) {
// Change Trigger.old[0].OwnerId to Current User ID
Trigger.new[0].OwnerId = UserInfo.getUserId();
}
}
}
Can you post your Requirement Clearly.
I am trying to create a class that matches my current trigger. My current trigger should assign the case to the current user upon case close but I am limiting it to certain roles
Try this code
hi
i think no need any class in this situation. Trigger is best option.