• munna321
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 4
    Replies

Hi All,


 Appreciate if you could help me correct this trigger

When a custom field(Is_Serviceable__c) on the custom object (Product_Master__c) is true, then create or update the fields on Asset by the fields of custom object(Contract_Product__c).

trigger UpdateAsset on Product_Master__c (after insert, after update) {

        //List Asset to insert, update

      List<Asset> insertASList      = new List<Asset>();

      List<Asset> updateASList      = new List<Asset>();

 

      for(Product_Master__c pm:trigger.new){

      for(Contract_Product__c cp:trigger.new){

     //check for the checkbox

      if(trigger.isinsert && trigger.isafter && pm.Is_Serviceable__c==true){

     cp.add(new Contract_Product__c(Contract_Start_Date__c=AS.Contract_Start_Date__c, Contract_End_Date__c=AS.Contract_End_Date__c));

      }

     //check for the checkbox update on Product_Master__c

      if(trigger.isupdate && trigger.isafter && pm.Is_Serviceable__c==true){

     cp.add(new Contract_Product__c(Contract_Start_Date__c=AS.Contract_Start_Date__c, Contract_End_Date__c=AS.Contract_End_Date__c));

      }  

    }

      }

    insert insertASList;

    update updateASList;

 

}

 

}

Hi All,

 

Appreciate if you could help me correct this trigger


When a custom lookup field on opportunity(Contract__c) is updated then some fields from Contract standard object should autofill the fields on opportunity.

 

trigger UpdateOpportunity on Opportunity (after insertafter update) {

            //List opportunity to insert, update

      List<opportunity> insertOPList= new List<Opportunity>();

      List<opportunity> updateOPList= new List<Opportunity>();

 

      for(Contract co:trigger.new){

     //check for the contract lookup on Opprtuinty

      if(trigger.isinsert && trigger.isafter && OP.Contract__c==true){

     OP.add(new pportunity(Contract_Start_Date__c=co.Contract_Start_Date__c, Contract_End_Date__c=co.Contract_End_Date__c));

      }

     //check for the contract lookup update on Opprtuinty

      if(trigger.isupdate && trigger.isafter && OP.Contract__c==true){

     OP.add(new pportunity(Contract_Start_Date__c=co.Contract_Start_Date__c, Contract_End_Date__c=co.Contract_End_Date__c));

      }  

    }

    insert insertOPList;

    update updateOPList;

 

}

 

}





Hi All,


 Appreciate if you could help me correct this trigger

When a custom field(Is_Serviceable__c) on the custom object (Product_Master__c) is true, then create or update the fields on Asset by the fields of custom object(Contract_Product__c).

trigger UpdateAsset on Product_Master__c (after insert, after update) {

        //List Asset to insert, update

      List<Asset> insertASList      = new List<Asset>();

      List<Asset> updateASList      = new List<Asset>();

 

      for(Product_Master__c pm:trigger.new){

      for(Contract_Product__c cp:trigger.new){

     //check for the checkbox

      if(trigger.isinsert && trigger.isafter && pm.Is_Serviceable__c==true){

     cp.add(new Contract_Product__c(Contract_Start_Date__c=AS.Contract_Start_Date__c, Contract_End_Date__c=AS.Contract_End_Date__c));

      }

     //check for the checkbox update on Product_Master__c

      if(trigger.isupdate && trigger.isafter && pm.Is_Serviceable__c==true){

     cp.add(new Contract_Product__c(Contract_Start_Date__c=AS.Contract_Start_Date__c, Contract_End_Date__c=AS.Contract_End_Date__c));

      }  

    }

      }

    insert insertASList;

    update updateASList;

 

}

 

}

Hi All,

 

Appreciate if you could help me correct this trigger


When a custom lookup field on opportunity(Contract__c) is updated then some fields from Contract standard object should autofill the fields on opportunity.

 

trigger UpdateOpportunity on Opportunity (after insertafter update) {

            //List opportunity to insert, update

      List<opportunity> insertOPList= new List<Opportunity>();

      List<opportunity> updateOPList= new List<Opportunity>();

 

      for(Contract co:trigger.new){

     //check for the contract lookup on Opprtuinty

      if(trigger.isinsert && trigger.isafter && OP.Contract__c==true){

     OP.add(new pportunity(Contract_Start_Date__c=co.Contract_Start_Date__c, Contract_End_Date__c=co.Contract_End_Date__c));

      }

     //check for the contract lookup update on Opprtuinty

      if(trigger.isupdate && trigger.isafter && OP.Contract__c==true){

     OP.add(new pportunity(Contract_Start_Date__c=co.Contract_Start_Date__c, Contract_End_Date__c=co.Contract_End_Date__c));

      }  

    }

    insert insertOPList;

    update updateOPList;

 

}

 

}