Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
trigger OppTrigger on Opportunity (after insert, before update) {
Map<String, Id> typeMap = New Map<ID,RecordType>();
for(RecordType rt: [Select ID, DeveloperName From RecordType Where sObjectType = 'Opportunity']) {
for (Opportunity opp : {
// And the Agreement Category on the record = TEST
if (opp.Stage__c == 'Negotiation/Review') {
// Then automatically change the Record Type to ReadOnly RecordType
opp.RecordTypeID = typeMap.get('ReadOnly');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.