You need to sign in to do that
Don't have an account?

Trigger does not exist error
I'm trying to learn how to write a trigger that calls a class. When trying to deploy I'm getting this error "Trigger does not exist: Trigger"
Here's my Trigger:
Here's my Trigger:
trigger MasterOnboardingTrigger on Onboarding__c ( before insert, after insert, before update, after update, before delete, after delete) { if (Trigger.isBefore) { if (Trigger.isInsert) { // Call class logic here! } if (Trigger.isUpdate) { // Call class logic here! FulfillmentFirst ful = new FulfillmentFirst(Trigger.new); } if (Trigger.isDelete) { // Call class logic here! } } if (Trigger.IsAfter) { if (Trigger.isInsert) { // Call class logic here! } if (Trigger.isUpdate) { // Call class logic here! } if (Trigger.isDelete) { // Call class logic here! } } }And here's my class:
public class FulfillmentFirst { // This will hold the onboarding record passed by the trigger List<Onboarding__c> onbs; public FulfillmentFirst (List<Onboarding__c> triggerOnb) { onbs = triggerOnb; } public void CreateFirstFulfillment(){ for(Onboarding__c onb : onbs){ if(onb.Fulfillment_Created__c = false){ // Engage if(onb.Product__c == 'Engage'){ Fulfillment__c enFul = new Fulfillment__c(); enFul.Name = 'Engage First Fulfillment + ' + onb.Account__r.Name; enFul.Status__c = 'Not Started'; enFul.Account__c = onb.Account__c; enFul.Due_Date__c = Date.today().addDays(14); enFul.RecordTypeId = '0121I000000G1dkQAC'; insert enFul; onb.Fulfillment_Created__c = true; update onb; } // Social Ads if(onb.Product__c == 'Social Ads'){ Fulfillment__c saFul = new Fulfillment__c(); saFul.Name = 'Social Ads First Fulfillment + ' + onb.Account__r.Name; saFul.Status__c = 'Not Started'; saFul.Account__c = onb.Account__c; saFul.Due_Date__c = Date.today().addDays(14); saFul.RecordTypeId = '0121I000000G1dmQAC'; insert saFul; onb.Fulfillment_Created__c = true; update onb; } // Social Posting if(onb.Product__c == 'Social Posting'){ Fulfillment__c spFul = new Fulfillment__c(); spFul.Name = 'Social Posting First Fulfillment + ' + onb.Account__r.Name; spFul.Status__c = 'Not Started'; spFul.Account__c = onb.Account__c; spFul.Due_Date__c = Date.today().addDays(14); spFul.RecordTypeId = '0121I000000G1doQAC'; insert spFul; onb.Fulfillment_Created__c = true; update onb; } } } } }Any help would be much appreciated.
The only possible explanation for your scenario seems to be that you might be having another class named trigger in your org. Please check in your org if this is the case. You can also try to write System.Trigger.new instead of Trigger.new, which will simply route the trigger call to the standard Trigger class instead of any custom-written class.
Hope that answers your question.
All Answers
The only possible explanation for your scenario seems to be that you might be having another class named trigger in your org. Please check in your org if this is the case. You can also try to write System.Trigger.new instead of Trigger.new, which will simply route the trigger call to the standard Trigger class instead of any custom-written class.
Hope that answers your question.