Mode:
Duration:
1
Coding works best on desktop or with an external keyboard.
Coding works best on desktop or with an external keyboard.
Prevents an Opportunity from being closed without a description.
trigger OpportunityValidation on Opportunity (before update) {
for (Opportunity opp : Trigger.new) {
if (opp.StageName == 'Closed Won' && String.isBlank(opp.Description)) {
opp.addError('Description is required before closing an Opportunity.');
}
}
}Salesforce Apex is a strongly typed, Java-like programming language used to implement custom business logic on the Salesforce Platform. It provides server-side execution within the multi-tenant Salesforce environment, enabling automation, integrations, transactional operations, and advanced customization beyond declarative tools.
Origin & Creator
Created by Salesforce to allow controlled, secure server-side programming on the CRM platform, evolving since 2006 alongside the Force.com ecosystem.
Industrial Note
Large enterprises rely heavily on Apex to implement governed workflows, ERP-like processes, and integrations across distributed systems.