+ Start a Discussion

User Class in trigger - get a return from Trigger helper class

Hi. I am writing a trigger that will require a return of data from a before update helper back to the trigger so that I can pass the info to the after update section of the trigger. I 'thought' I could creat a user class in the trigger and then reference it in the trigger helper but I am getting an Invalid Type errror in the trigger helper. Code is below.

The real question is - how can pass a user class back to the trigger from the trigger helper so that I can use it in the after update section of the trigger?

Any thoughts? Many thanks
trigger LeadTrigger on Lead (after delete, after insert, after undelete, after update, before delete, before insert, before update) {

    List<leadIdBDSandTypeofEMail> leadToBDSForEmail = new List<leadIdBDSandTypeofEMail>();
    Id idOfLastBDStoGetLead;
    Boolean weShouldBumpLead;

    public static void leadRoundRobin(
    List<Lead> newTrigger,
    List<Lead> oldTrigger,
    Map<Id, Lead> oldMap,
    Id idOfLastBDStoGetLead,
    Boolean weShouldBumpLead,
	List<leadIdBDSamdTypeofEMail> leadToBDSForEmail)

    if((trigger.isInsert || trigger.isUpdate) && trigger.isBefore){
    	LeadTriggerHelper.leadRoundRobin(trigger.new, trigger.old, trigger.oldMap);

    if((trigger.isInsert || trigger.isUpdate) && trigger.isAfter){
    	LeadTriggerHelper.createTasksEmails(trigger.new, trigger.old, trigger.oldMap);

    public class leadIdBDSandTypeofEMail{
        public Id idofLead;
        public Id idOfBDS;
        public string typeOfEmail;


public with sharing class LeadTriggerHelper {

	public static void leadRoundRobin(List<Lead> newTrigger, List<Lead> oldTrigger, Map<Id, Lead> oldMap){

		List<LeadTrigger.leadIdBDSandTypeofEMail> returnLeadBDType = new List<leadIdBDSandTypeofEMail>();

... and lots more code that is irrelevant to the question....

Ahmed Ansari 13Ahmed Ansari 13
Hello Linked2Mark,
if you write   class in triggeryou can't use it  out of the trigger