Set Case Priority Based on Case Origin

This trigger dynamically sets the Priority of a Case based on its Origin. If the Origin is “Phone,” the Priority is set to “High.” Otherwise, it defaults to “Low.” This approach ensures effective case handling based on urgency.

For more examples, visit this YouTube playlist.

Solution:

trigger CaseTrigger on Case (before insert) {
      if(Trigger.isBefore && Trigger.isInsert) {
            for (Case caseRecord : Trigger.NEW) {
                if (caseRecord.CaseOrigin == ‘Phone’) {
                      caseRecord.Priority = ‘High’;
                }
                else{
                     caseRecord.Priority = ‘Low’;
                }
           }
       }
   }

Want to Apply As Content Writer?

Leave a Comment

Your email address will not be published. Required fields are marked *

Shopping Cart

Let's get you started!

Interested in writing Salesforce Content?

Fill in this form and we will get in touch with you :)