WeDid: Dynamic Auto Number

Challenges

The customer plans and implements programs/services for their clients.

They keep track on opportunities using ascending/unique auto numbers. These job numbers will only be assigned to opportunities that hits certain stage.

For this scenario, we have ruled out the Salesforce standard auto-number field as the unique numbers are assigned to all opportunity records.

 

Sample:

 

Opportunity Stage Auto Number
Opportunity 1 Closed Won 001
Opportunity 2 Prospecting
Opportunity 3 Negotiating
Opportunity 4 Closed Won 002

 

Solution:

Dynamically assigned auto number to opportunities at certain stage.

 

Related Objects Opportunity, Custom Settings
Components Apex Trigger and Apex Class
Complexity Moderate