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
Steve Harris 9Steve Harris 9 

I am receiving a trigger error in our production org but the trigger owner that created it is no longer in business so I am not sure how to deactivate the trigger now or fix it. Any suggestions would be greatly appreciated!

User-added image
User-added image
Best Answer chosen by Steve Harris 9
v varaprasadv varaprasad
Hi Steve,

Please check following links to deactivate trigger in production :

https://help.salesforce.com/articleView?id=000005417&type=1

There are two way to deactivate the Trigger directly in prod

1) Create custom setting to activate or deactivate trigger (Best One)
https://www.sundoginteractive.com/blog/disabling-triggers-in-production-dynamically
http://www.salesforcegeneral.com/salesforce-articles/salesforce-bypass-rules-and-triggers.html

2) You can also do the same by eclipse. Please check post
https://help.salesforce.com/apex/HTViewSolution?id=000005417&language=en_US (https://help.salesforce.com/apex/HTViewSolution?id=000005417&language=en_US)

Important: You must consider the consequences of disabling a trigger in the production environment during work hours. It is highly recommended to perform this work outside normal business hours and to disable access to the application to non-administrators during the maintenance period.

Follow these steps:
1) Disable the trigger in the sandbox environment
2) Create a new project in Eclipse using the Sandbox and including the trigger (or refresh your existing Eclipse project)
3) Alternative: edit the trigger name.trigger-meta.xml in an existing project and change the status node to false: <status>Inactive</status>
4) Save the change locally
5) Deploy the trigger to production
6) Complete the data load
7) If the change is not permanent or you want to enable the trigger again then enable the trigger by making it active on the sandbox or project again and deploy it to production

Please let us know if this will help you


Thanks
Varaprasad
@For Support: varaprasad4sfdc@gmail.com

All Answers

v varaprasadv varaprasad
Hi Steve,

Please check following links to deactivate trigger in production :

https://help.salesforce.com/articleView?id=000005417&type=1

There are two way to deactivate the Trigger directly in prod

1) Create custom setting to activate or deactivate trigger (Best One)
https://www.sundoginteractive.com/blog/disabling-triggers-in-production-dynamically
http://www.salesforcegeneral.com/salesforce-articles/salesforce-bypass-rules-and-triggers.html

2) You can also do the same by eclipse. Please check post
https://help.salesforce.com/apex/HTViewSolution?id=000005417&language=en_US (https://help.salesforce.com/apex/HTViewSolution?id=000005417&language=en_US)

Important: You must consider the consequences of disabling a trigger in the production environment during work hours. It is highly recommended to perform this work outside normal business hours and to disable access to the application to non-administrators during the maintenance period.

Follow these steps:
1) Disable the trigger in the sandbox environment
2) Create a new project in Eclipse using the Sandbox and including the trigger (or refresh your existing Eclipse project)
3) Alternative: edit the trigger name.trigger-meta.xml in an existing project and change the status node to false: <status>Inactive</status>
4) Save the change locally
5) Deploy the trigger to production
6) Complete the data load
7) If the change is not permanent or you want to enable the trigger again then enable the trigger by making it active on the sandbox or project again and deploy it to production

Please let us know if this will help you


Thanks
Varaprasad
@For Support: varaprasad4sfdc@gmail.com
This was selected as the best answer
Santosh Reddy MaddhuriSantosh Reddy Maddhuri
Hi @Steve Harris 9

Modify trigger code along the below lines and it should work.Code snippet was written with assumption there is Prodcut2Id field on R00N70000001IXB6EAM.

Code Snippet.
if(prdIds.size()>0)
  prdList = [Select Id,SBQQ__Specifications__c FROM Product2 Where Id IN : prdIds];

  Map<Id,Product2>PrdMap = new Map<Id,Product2>();

  for(Product2 p : prdList){

    PrdMap.put(p.Id,p);

  }

   for(SBQQ_QuoteLine__c qli : Select Id,Specifications__c,Product2Id from R00N70000001IXB6EAM Where Product2Id IN : prdIds){

        Prdoduct2 PrdRec =  PrdMap.get(qli.Product2Id);
        if(qli.Specifications__c != PrdRec.SBQQ__Specifications__c)
           qli.Specifications__c = PrdRec.SBQQ__Specifications__c;
        qliListToUpdate.add(qli);    
   }

 

  if(qliListToUpdate.size()>0)  
     update qliListToUpdate;

 
Steve Harris 9Steve Harris 9
HI @Santosh Reddy Maddhuri
I am getting the following error message when trying to save the code with your recommendation. Any suggestions?  Am I entering the snipit in the wrong place?

"Error: Compile Error: Unexpected token 'Select'. at line 20 column 32"

New code:
trigger UpdateQLISpec1 on Product2 (after update){//,before delete) {
    
    Set<Id> prdIds = new Set<Id>(); 
    List<SBQQ__QuoteLine__c> qliListToUpdate = new List<SBQQ__QuoteLine__c>();
    for(Product2 prd:trigger.new){
        prdIds.add(prd.Id);
    }
    List<Product2> prdList= new List<Product2>();
    if(prdIds.size()>0)
  prdList = [Select Id,SBQQ__Specifications__c FROM Product2 Where Id IN : prdIds];

  Map<Id,Product2>PrdMap = new Map<Id,Product2>();

  for(Product2 p : prdList){

    PrdMap.put(p.Id,p);

  }

   for(SBQQ_QuoteLine__c qli : Select Id,Specifications__c,Product2Id from R00N70000001IXB6EAM Where Product2Id IN : prdIds){

        Prdoduct2 PrdRec =  PrdMap.get(qli.Product2Id);
        if(qli.Specifications__c != PrdRec.SBQQ__Specifications__c)
           qli.Specifications__c = PrdRec.SBQQ__Specifications__c;
        qliListToUpdate.add(qli);    
   }

 

  if(qliListToUpdate.size()>0)  
     update qliListToUpdate;
}
v varaprasadv varaprasad
Hi Steve.

Change line like below.
  for(SBQQ_QuoteLine__c qli : [Select Id,Specifications__c,Product2Id from R00N70000001IXB6EAM Where Product2Id IN : prdIds]){

Thanks
Varaprasad
Steve Harris 9Steve Harris 9
Hi Varaprasad,

Thanks for the response!  I am now getting error:


Error: Compile Error: Invalid type: Schema.R00N70000001IXB6EAM at line 20 column 33

Thanks
Steve