Created
April 26, 2013 19:59
-
-
Save dancinllama/5470054 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 mytrigger on object(before update){ | |
for(Object current : Trigger.new){ | |
Object olObject = Trigger.oldMap.get(current.Id); | |
if(olObject.MyField__c != current.MyField__c && otherConditionsGoHere){ | |
//Option1 | |
olObject.MyField__c.addError('Cannot do that, Hal..'); | |
//Option2 | |
current.MyField__c = olObject.MyField__c; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment