You need to sign in to do that
Don't have an account?
bob4
Don't allow user to edit multiple cases
I have a scenario where users will be taking ownership of some cases by checking the checkbox and clicking the button. The problem I am facing here is if multiple users select the same case at the same time to work on an error should be thrown to all the users except the first one saying this case is already taken by other user to work. I really don't understand how to implement this logic in my visualforce page. I cannot post my code as it is too long and snippet to implement the above scenario is much appreciated. Thanks.
public id selectedCaseID {get;set;}
public PageReference setCaseOwner(){
List<case> caseBeingTransfered = [SELECT ID, OwnerID FROM Case WHERE ID = :selectedCaseID];
if (!caseBeingTransfered.isEmpty()){//we do this to avoid tossing an error if the case was recently deleted.
if (caseBeingTransfered.OwnerID != queueID) {
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,Label.RecentlyReassignedCaseMsg));//use custom labels to let admins customize the message to their user base
} else {
case caseBeingTransfered.OwnerID = userID;
update case;
}
} else {
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,Label.CaseMissingMsg));//use custom labels to let admins customize the message to their user base
}
}