• Suhaas Kapardhi B S
  • NEWBIE
  • 40 Points
  • Member since 2022

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 8
    Replies
I need o update the accounts name in the case record when I create a Case using custom modal which i have created. Below is the code which I have written.

trigger modalAccount on Case (after insert, after update) {
    
    Set<id> cas = new Set<id>();
    List<Account> acclist = new List<Account>();
   
    for(Case c:Trigger.new ){
         cas.add(c.AccountId);
        }
    
    List<Account> acc = [Select id, Name From Account Where id in: cas];
    
    for(Account temp:acc){
        temp.Name= 'sample Account Name';
        acclist.add(temp);  
    }
    update acclist;
}


The code which I have written is not working. 

Please help
I need to create and approval process on case object when the Account's Annual revenue is fluctuated.
Can you help please
Hi, I have created a trigger on case to update its related account name when I create a new case, but I am not sure about my code.Please help.



trigger modalAccount on Case (after insert) {
    
    Set<id> cas = new Set<id>();
    List <Case> ca = [SELECT AccountId,id From Case Where id in:trigger.new];
    for(Case c:ca ){
    cas.add(c.AccountId);
        }
    List<Account> acc = [Select Name From Account Where id in: cas];
    for(Account temp:acc){
        ca.AccountId=temp.Name;
    }

}



Thanks & Regards
Suhaas 
Hi , I am new to salesforce, I have a below scenario, I just wanted to know whether I nned to create a multiple approval processes or can I create one and do the required 


If the Account’s Annual Revenue is > 0, then it will assign to “Initial Approval User” (Queue). If the Initial Approval User approve the case then it will go to next steps else it will be final rejection and update the case status to Rejected, if the Initial Approval User reject the case.

If the Account’s Annual Revenue is > 500, then it will assign to “Immediate Approval User” (Queue). If the Immediate Approval User approve the case then it will go to next steps else it will be final rejection and update the case status to Rejected, if the Immediate Approval User reject the case.
If the Account’s Annual Revenue is > 10,000, then assign it to “Yourself”. If the you approve the case then it will update the case status to Closed else it will be final rejection and update the case status to Rejected, if the Immediate Approval User reject the case. (mandatory)



Thanks & Regards
Suhaas

 
I have an account with associated opportunities. When I update an opportunity's email address, it will check the associated Account and retrieve the related opportunities to see if all of the opportunities email addresses are the same as the updated email address. If so, it will not update the email address on the opportunity record; otherwise, it will update the email address with the updated email address.
I have an account with associated opportunities. When I update an opportunity's email address, it will check the associated Account and retrieve the related opportunities to see if all of the opportunities email addresses are the same as the updated email address. If so, it will not update the email address on the opportunity record; otherwise, it will update the email address with the updated email address.


Thanks 
Suhaas

 
trigger EmailUpdation on Opportunity (before update) {
    
    
    Set<Id> accId = new Set<Id>();
    Set<String> oppEmail = new Set<String>();
    Set<String> oldEmail = new Set<String>();
    List<Opportunity> accRelaOppEmail = new List<Opportunity>();
    

    for(Opportunity opp: Trigger.new){
        
        oppEmail.add(opp.Email__c);
        
        accId.add(opp.AccountId);
    }
    
    
    accRelaOppEmail= [Select Id, Email__c from Opportunity where AccountId in :accId and Account_Email__c in :opp.Email__c];
    
    for(Opportunity opp: accRelaOppEmail){
        
        oldEmail.add(opp.Email__c);
     }
    
    for(Opportunity opp: trigger.new){

        if(oldEmail.contains(opp.Email__c) && oldEmail.size() != accRelaOppEmail.size() ){
            

            

    
         }
       }
    }
I need o update the accounts name in the case record when I create a Case using custom modal which i have created. Below is the code which I have written.

trigger modalAccount on Case (after insert, after update) {
    
    Set<id> cas = new Set<id>();
    List<Account> acclist = new List<Account>();
   
    for(Case c:Trigger.new ){
         cas.add(c.AccountId);
        }
    
    List<Account> acc = [Select id, Name From Account Where id in: cas];
    
    for(Account temp:acc){
        temp.Name= 'sample Account Name';
        acclist.add(temp);  
    }
    update acclist;
}


The code which I have written is not working. 

Please help
Hi, I have created a trigger on case to update its related account name when I create a new case, but I am not sure about my code.Please help.



trigger modalAccount on Case (after insert) {
    
    Set<id> cas = new Set<id>();
    List <Case> ca = [SELECT AccountId,id From Case Where id in:trigger.new];
    for(Case c:ca ){
    cas.add(c.AccountId);
        }
    List<Account> acc = [Select Name From Account Where id in: cas];
    for(Account temp:acc){
        ca.AccountId=temp.Name;
    }

}



Thanks & Regards
Suhaas 
Hi , I am new to salesforce, I have a below scenario, I just wanted to know whether I nned to create a multiple approval processes or can I create one and do the required 


If the Account’s Annual Revenue is > 0, then it will assign to “Initial Approval User” (Queue). If the Initial Approval User approve the case then it will go to next steps else it will be final rejection and update the case status to Rejected, if the Initial Approval User reject the case.

If the Account’s Annual Revenue is > 500, then it will assign to “Immediate Approval User” (Queue). If the Immediate Approval User approve the case then it will go to next steps else it will be final rejection and update the case status to Rejected, if the Immediate Approval User reject the case.
If the Account’s Annual Revenue is > 10,000, then assign it to “Yourself”. If the you approve the case then it will update the case status to Closed else it will be final rejection and update the case status to Rejected, if the Immediate Approval User reject the case. (mandatory)



Thanks & Regards
Suhaas

 
I have an account with associated opportunities. When I update an opportunity's email address, it will check the associated Account and retrieve the related opportunities to see if all of the opportunities email addresses are the same as the updated email address. If so, it will not update the email address on the opportunity record; otherwise, it will update the email address with the updated email address.
I have an account with associated opportunities. When I update an opportunity's email address, it will check the associated Account and retrieve the related opportunities to see if all of the opportunities email addresses are the same as the updated email address. If so, it will not update the email address on the opportunity record; otherwise, it will update the email address with the updated email address.


Thanks 
Suhaas

 
trigger EmailUpdation on Opportunity (before update) {
    
    
    Set<Id> accId = new Set<Id>();
    Set<String> oppEmail = new Set<String>();
    Set<String> oldEmail = new Set<String>();
    List<Opportunity> accRelaOppEmail = new List<Opportunity>();
    

    for(Opportunity opp: Trigger.new){
        
        oppEmail.add(opp.Email__c);
        
        accId.add(opp.AccountId);
    }
    
    
    accRelaOppEmail= [Select Id, Email__c from Opportunity where AccountId in :accId and Account_Email__c in :opp.Email__c];
    
    for(Opportunity opp: accRelaOppEmail){
        
        oldEmail.add(opp.Email__c);
     }
    
    for(Opportunity opp: trigger.new){

        if(oldEmail.contains(opp.Email__c) && oldEmail.size() != accRelaOppEmail.size() ){
            

            

    
         }
       }
    }