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
Gorka SanzGorka Sanz 

test production

I'm new in Salesforce.

I create a trigger in Opportunities (very easy...):

trigger ClosedOpportunityTrigger on Opportunity (after insert) {
List<task> carry=New List<task>();
  for(opportunity opp:trigger.new){
  
    task t=new task(
        whatid=opp.id,
        Status = 'Active',
        Subject = 'Seguimiento Automatico',
        ActivityDate = system.today()
     );
    carry.add(t);
  
   }
     insert carry;
}

I Create also a test, very easy and copies:

@isTest
private class TestAccountDeletion {
    @isTest static void TestDeleteAccountWithOneOpportunity() {
        Account acct = new Account(Name='Test Account');
        insert acct;
        test.startTest();
        Opportunity opp = new Opportunity(Name=acct.Name + ' Opportunity',StageName='Prospecting',CloseDate=System.today().addMonths(1),AccountId=acct.Id);
        insert opp;
        test.stopTest();
    }
    
}
Work's fine, without errors and a 100% of code validate.
I create a change set, but i cant validate in production. What is the step missing?

Thanks in advance
Best Answer chosen by Gorka Sanz
Raj VakatiRaj Vakati
Did you include in ClosedOpportunityTrigger trigger and test class TestAccountDeletion in changeset?


What is the error you are getting? 


If you getting code coverage issues because of the other codes, Run only specific test class by specifying TestAccountDeletion

All Answers

Raj VakatiRaj Vakati
Did you include in ClosedOpportunityTrigger trigger and test class TestAccountDeletion in changeset?


What is the error you are getting? 


If you getting code coverage issues because of the other codes, Run only specific test class by specifying TestAccountDeletion
This was selected as the best answer
Gorka SanzGorka Sanz
Thanks, finally I punt in a same change set either the trigger and the test class, and that works for me.

Thanks for the clue!!
Raj VakatiRaj Vakati
Cool