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 :
        CustomNumber = bl.Customer_Number__c;
    accountList = [Select Id, OwnerId, Customer_Number__pc from Account where Customer_Number__pc =:CustomNumber ];
    for(Booking_Link__c bl :
        system.debug('Entered into ');
        for(Account a : accountList)
            system.debug('Entered into accountList loop ');
           if(bl.Customer_Number__c == a.Customer_Number__pc && bl.T2G__c==True)
                system.debug('Entered into if loop');
                bl.Account__c = a.Id;
                bl.OwnerId = a.OwnerId;

Its Test Class:

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.