Skip to main content
Hi Guys,

Can you please help me out with this Trigger?

Whenever any record is created or edited on kugo2p__SalesOrder__c then it should copy kugo2p__BillingFrequency__c field value to other Custom Object I have kugo2p__SalesOrderServiceLine__c and the field name is Billing_Frequency__c. kugo2p__SalesOrderServiceLine__c is the Child of kugo2p__SalesOrder__c. 

Also this Trigger should only update field when on kugo2p__SalesOrder__c we have Order_Form_Type__c = New Order OR Upsell – Independent OR Upsell – Coterminous OR Organic Growth OR Credit OR Renewal OR Renewal – Entitlement Reconciliation OR New – Entitlement Reconciliation OR Upsell – Entitlement Reconciliation
5 answers
  1. Jul 31, 2015, 10:01 AM
    I don't know if this work or no, but at least you can give it a try:

    trigger Trigger_kugo2p__SalesOrder__c on kugo2p__SalesOrder__c (after insert, after update) {

        for(kugo2p__SalesOrder__c kugoSO:Trigger.new){

            Set<String> OrderType = new Set<String>();

            List<String> AllowedOrderType = new List<String> {'New Order','Upsell – Independent','Upsell – Coterminous','Organic Growth','Credit','Renewal','Renewal – Entitlement Reconciliation',' New – Entitlement Reconciliation','Upsell – Entitlement Reconciliation'};      

            OrderType.addAll(AllowedOrderType);

            boolean checker = OrderType.contains(kugoSO.Order_Form_Type__c);

            if(checker)

            {

                kugo2p__SalesOrderServiceLine__c kugo2pSL = [SELECT id from kugo2p__SalesOrderServiceLine__c where kugo2p__SalesOrder__c =: kugoSO.id];        

                kugo2pSL.Billing_Frequency__c = kugoSO.BillingFrequency__c;

                update kugo2pSL;

            }        

        }

    }

     
0/9000