function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
azhar khasimazhar khasim 

Trigger working in Sandbox but not working in Production

My Trigger is working in sandbox but not working in Production.
Help me out

My Trigger:

trigger AccountNameUpdate on Booking_Link__c (before insert, before update) {
    List<Account> accountList = new List<Account>();
    String CustomNumber;
    for(Booking_Link__c bl : Trigger.new)
    {       
        CustomNumber = bl.Customer_Number__c;
       
    }
    system.debug(CustomNumber);
    accountList = [Select Id, OwnerId, Customer_Number__pc from Account where Customer_Number__pc =:CustomNumber ];
    system.debug(accountList);
    for(Booking_Link__c bl : Trigger.new)
    {
        system.debug('Entered into Trigger.new ');
        for(Account a : accountList)
        {
            system.debug('Entered into accountList loop ');
            system.debug(bl.Customer_Number__c);
            system.debug(a.Customer_Number__pc);
            system.debug(bl.T2G__c);
            
           if(bl.Customer_Number__c == a.Customer_Number__pc && bl.T2G__c==True)
            {
                system.debug('Entered into if loop');
                system.debug(a.Id);
                system.debug(a.OwnerId);
                bl.Account__c = a.Id;
                bl.OwnerId = a.OwnerId;
                  
            }
        }
    }  
}

Its Test Class:

@isTest
public class AccountNameUpdate {
@isTest  static void updateAccount(){
        Account a = new Account();
        a.Name = 'Abhishek Gupta';
        insert a;
        Booking_Link__c bl= new Booking_Link__c();
        bl.Customer_Number__c = a.Customer_Number__pc;
        bl.T2G__c =True;
        bl.Account__c = a.Id;
        //bl.OwnerId = a.OwnerId;
        insert bl;
    }
}


Please help me out from thiss..

Thanks and Regards,
Azar Khasim.
Rounak SharmaRounak Sharma
hello Azar,
Please check if it is active or not
User-added image
next check if any other trigger is also written on that object or not.
Put debug statement if it fires or not?

Please let me know if you have doubt.
thanks