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
Mats ErikssonMats 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?

dtravellerdtraveller

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.