We're using a Visualforce page on the case page layout to automatically assign the case to the user that clicks on it and opens it from the queue. Here is the markup below and it works great, but we need to add a rule to it where it only reassigns the case when the user is assigned to a specific profile ID. Any ideas on how to update this to work? Thanks in advance!
<apex:page standardController="Case">
<apex:remoteObjects >
<apex:remoteObjectModel name="Case" fields="Id, OwnerId">
</apex:remoteObjectModel>
</apex:remoteObjects>
<script type="application/javascript">
var caseToUpdate = new SObjectModel.Case();
caseToUpdate.set('Id', '{!Case.Id}');
caseToUpdate.set('OwnerId', '{!$User.Id}');
caseToUpdate.update();
</script>