You need to sign in to do that
Don't have an account?
Mats Eriksson
Determining if a case comment trigger fires on a comment made by an SSP user
Hi,
I have created a trigger on case comments that update a field on the parent case. It works very nicely. But when I want to select only cases that are created by SSP Users I have run into problems.
I tried getUserType() in the rem:ed line below (I also check for case status there) but it doesn't act differently so I assum both internal and external SSP users are of type 'Standard''
trigger IsNewCaseComment on CaseComment (after insert) { Map<Id,CaseComment> cMap = new Map<Id,CaseComment>(); for (CaseComment t: Trigger.new){ cMap.put(t.ParentId,t); } List<Case> CasesToUpdate = new List<Case>(); Set<Id> idSet = cMap.keySet(); for(Case c:[select Id,CreatedById,Status,IsNewCaseComment__c from Case where Id in :idSet]) { { //if (C.Status !='Waiting for Documentation' && UserInfo.getUserType()!='Standard'){ c.IsNewCaseComment__c=true; CasesToUpdate.add(c); //} } } update CasesToUpdate; }
Any idea on how to proceed?
That's a good question. In the API documentation for the User object, there is a description of the UserType field. I assume these are the values returned by getUserType():
http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_user.htm
You could also retrieve the User record and test the value of the isPortalEnabled field.