Skip to content

Instantly share code, notes, and snippets.

@mxalix258
mxalix258 / Field update if contained in set
Created May 31, 2013 15:42
Check if field value is contained in a defined set, and update the field.
trigger OnboardingEvacSectionUpdate on On_Off_Boarding__c (before insert, before update){
List <On_Off_Boarding__c> obToUpdate = new List <On_Off_Boarding__c> ();
//New set is defined that contains the values 202, 0-203A, etc
Set <String> s1 = new Set<String>{'202', '0-203A'};
For(On_Off_Boarding__c ob: Trigger.new){
// Checks if Desk_location1__c is in the set s1, and updates the field