• vkanthanrk
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

The scenario is : Record automatically created when record type is  equal to  "New InstallBase".

 

                               Trigger is working fine, just want to add if condition with record type.

 

Trigger Code: 

 

 

rigger addInstallBase on Case (after insert, after update) {
  // Install bases to create
  List<Install_Base__c> installBases = new List<Install_Base__c>();
  for(Case c:Trigger.new) {
  
      
  
    // if(c.recordtype.name.equals("Post Install Warranty Registration")
   // {
    // If the old version had an unchecked box...
    if(Trigger.isInsert || !Trigger.oldmap.get(c.id).Approve__c) {
      // And the new version has a checked box...
      if(c.Approve__c) {
        // Add a new Install Base
        installBases.add(new Install_Base__c(
          // Assign values from case here, some examples...
          Case__c=c.id,project_size__c=c.Project_Size_kWp__c));
      }
   // }
    }
  }
  
 Appreciate your response.
Thanks,
Dhairya