• Shashank Somwanshi
  • NEWBIE
  • 20 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 3
    Replies
public class HSE_CaseTriggerHandler {
    
    public static void handleBeforeinsert(list<Case> newCases){
        
        List<Escalation_Matrix__c> compareValueobj = new List<Escalation_Matrix__c>();
        compareValueobj = [Select id, Reason__c, Severity__c, Sub_Reason__c from Escalation_Matrix__c Limit 5000];
        
        Map<String,Id> mapOfEscalationMatrix = new Map<String,Id>();
        
        For(Escalation_Matrix__c em : [Select id, Reason__c, Severity__c, Sub_Reason__c from Escalation_Matrix__c Limit 5000])
        {
            mapOfEscalationMatrix.put(em.Reason__c+'-'+em.Severity__c+'-'+em.Sub_Reason__c ,em.id);
        }
        
        Set<id> setofintent = new Set<id>();
        
        for(Case c: newCases)
        {
            if(c.Case_Reason_Intent__c!=NULL)            
                setofintent.add(c.Case_Reason_Intent__c);
        }
        
        //Lookup on case reason intent to get the name
        Map<Id,String> mapOfIntent = new Map<Id,String>();
        For(Case_Reason_Intent__c cri : [Select id,name from Case_Reason_Intent__c where id in : setofintent])
        {
            mapOfIntent.put(cri.id, cri.name);
        }
        
        Map<Id,String> mapOfIntentAll = new Map<Id,String>();
        For(Case_Reason_Intent__c cri : [Select id,name from Case_Reason_Intent__c])
        {
            mapOfIntentAll.put(cri.id, cri.name);
        }
        
     for(Case cs: newCases){
            if(cs.Subject !=NULL && cs.Case_Reason_Intent__c ==NULL && mapOfIntentAll.containskey(cs.name) == cs.Subject){
                cs.Case_Reason_Intent__c =  mapOfIntent.get(cs.Name);
                system.debug(cs.Case_Reason_Intent__c);
            }
            
        }    
        
        
        
        for(Case c: newCases){            
            if(c.status!='Closed' && !c.IsEscalated && c.status!=NULL && c.Case_Reason_Intent__c!=NULL && c.Sub_Reason__c !=NULL && c.Severity__c!=NULL && mapOfIntent.containskey(c.Case_Reason_Intent__c) && mapOfEscalationMatrix.containskey(mapOfIntent.get(c.Case_Reason_Intent__c)+'-'+c.Severity__c))
            {
                c.Escalation_Matrix__c = mapOfEscalationMatrix.get(mapOfIntent.get(c.Case_Reason_Intent__c)+'-'+c.Severity__c);
            }   
        }  
        
        
    }      
               
}
I have one picklist field. Which i want to be controlled of dependent on my lookup field value. For eg: If i select ABC on my lookup. Then 1,2,3 will only be select option on my picklist value. 
I have one picklist field. Which i want to be controlled of dependent on my lookup field value. For eg: If i select ABC on my lookup. Then 1,2,3 will only be select option on my picklist value. 
Hi,

We have a requirement to implement approval process for a custom object. The aproval request will be initiated by the owner of the custom object and sent to user who may/may not have a salesforce user licese. Once the user approves the request, the approval status should trigger a field update on the same object.

We want to use the standard approval process available on the force.com platform but the approval requests will also be send to users who do not have a salesforce user license.
 
Is this possible using the standard approval process to send email to external users?
Or how can this be done using Apex?
 
We appreciate all your feedbacks.
Regards
  • July 23, 2008
  • Like
  • 0