Created
August 15, 2018 15:01
-
-
Save escgeek/dbece81a90078aa4e581ba649d5e1a82 to your computer and use it in GitHub Desktop.
Quick Trigger to update a Picklist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trigger master_Latam_Sales_Transactions on Latam_Sales_Transactions__c (before insert, before update) { | |
// Lines 7-11 are just FYI debug in case there are recursive issues but otherwise are | |
// not needed and can be deleted. | |
if( | |
(Trigger.isUpdate || Trigger.isInsert) && | |
Trigger.isBefore | |
){ | |
String triggerType = 'Update'; | |
if(Trigger.isInsert){ | |
triggerType = 'Insert'; | |
} | |
System.debug('[1] ' + triggerType + ' - BEFORE trigger -------'); | |
for(Latam_Sales_Transactions__c lst : trigger.new){ | |
if(lst.Product_Family1__c <> lst.Product_Family_Map__c) | |
lst.Product_Family1__c = lst.Product_Family_Map__c; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment