You need to sign in to do that
Don't have an account?
Adelchi Pelizzo
Trigger Mistery
I deploy a trigger within a managed package and it does not run.
I copy and paste the trigger's code lines, to a new trigger on the same host org, and it works? Besides their name they are identical.
trigger Trigger_Name_1 on Account (before update) { SObject so = Schema.getGlobalDescribe().get('Account').newSObject(); Boolean b = so.getSobjectType().getDescribe().fields.getMap().containsKey('Labels__c'); if(b){ List<Account> oldAcc = Trigger.oldMap.values(); List<Account> newAcc = Trigger.newMap.values(); for(Integer i = 0; i < oldAcc.size(); i++){ if(b && oldAcc[i].Labels__c != newAcc[i].Labels__c){ System.debug('Inside if ...'); newAcc[i].adelAnyLab__Labels__c = newAcc[i].Labels__c; system.debug(newAcc[i].adelAnyLab__Labels__c); } } } } trigger Trigger_Name_2 on Account (before update) { SObject so = Schema.getGlobalDescribe().get('Account').newSObject(); Boolean b = so.getSobjectType().getDescribe().fields.getMap().containsKey('Labels__c'); if(b){ List<Account> oldAcc = Trigger.oldMap.values(); List<Account> newAcc = Trigger.newMap.values(); for(Integer i = 0; i < oldAcc.size(); i++){ if(b && oldAcc[i].Labels__c != newAcc[i].Labels__c){ System.debug('Inside if ...'); newAcc[i].adelAnyLab__Labels__c = newAcc[i].Labels__c; system.debug(newAcc[i].adelAnyLab__Labels__c); } } } }
Thanks,