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
sudha76sudha76 

Deploying Trigger without Test class.

Is it possible that a Trigger can be deployed on the production without test class. I have on Trigger which was built in 2009 and I do not see any test class associated to it on the production.

 

I find this weird, can Sales force allow that?

This Trigger looks like this:-

 

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

trigger AccountCreateTrigger on Account (before insert) {
for (Account acc: Trigger.new)
     {Account [] accs = [SELECT Name FROM Account WHERE Name = :acc.Name LIMIT 1];
      if (accs.size() > 0 ) //if account already exists, block and show the information on the page
         {acc.addError('Account  \'' + accs[0].Name +  '\' already exists. Please use existing account or contact your Salesforce Administrator for assistance.'); }
     }
}

Best Answer chosen by Admin (Salesforce Developers) 
sanjaypatidarsanjaypatidar

a Trigger without a test class is not possible, but in your case as this is only creation of account, there might be some test class which is creating an Accout and thus covering this trigger as well.

 

Let me know if this helps.


Cheers!!

Sanjay

All Answers

sanjaypatidarsanjaypatidar

a Trigger without a test class is not possible, but in your case as this is only creation of account, there might be some test class which is creating an Accout and thus covering this trigger as well.

 

Let me know if this helps.


Cheers!!

Sanjay

This was selected as the best answer
venkat-Dvenkat-D

Yes..salesforce do allow us to deploy code without test classes. You have to contact salesforce for that.

sudha76sudha76

yes, this is correct. 

 

I noticed in a different trigger an account is being created but it has no reference to this trigger. so maybe it is covered in the same.

 

thanks