User Story
As a user of the Apex code, I want to be able to generate a random stage name for a sales process. The stage name should be selected from a predefined list of stages, and each time I run the code, it should return a different stage name. This functionality will help me simulate different stages of a sales pipeline and test various scenarios without manually selecting the stage names.
Solution
Apex Method:
public static String generateStageName(){
List<String> myList = new List<String>{'Prospecting', 'Qualification', 'Needs Analysis', 'Value Proposition', 'Id. Decision Makers', 'Perception Analysis', 'Proposal/Price Quote', 'Negotiation/Review', 'Closed Won', 'Closed Lost'};
Integer index = Math.mod(Math.round(Math.random() * 100), myList.size());
return myList.get(index);
}
Video
Video does not exists.