• XJC
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies

Hello,

 

I recently tried deploying a change set from my sandbox to a production org (trigger as follows):

 

trigger AutoCreateRecord on Account (after insert) {
List<Record__c> Record= new List<Record__c>();
//For each Account record created, add a new record

//Note that Trigger.New is a list of all the new records

for (Account newAccount: Trigger.New)
{
if(
  newAccount.ispersonAccount == True &
  newAccount.Record_Required__c == True)
{
Record.add(new Record__c(Customer_name__c = newAccount.Id, Record_Status__c = 'Sent'));
}
}
insert Record;
}

 

This has worked well in the sandbox. However, I have since learned that I need to obtain test coverage of 75% of more for it to be used in production. I am new to apex and do not know how to do this. Any ideas would be appreciated, as the guides I've seen have been a bit beyond me!

 

Thanks!

  • March 21, 2013
  • Like
  • 0

Hi,

 

I am a newbie when it comes to apex and could do with some guidance. Basically, I am trying to create two different triggers, each firing under different scenarios.

 

On the first instance, I'd like a trigger which would fire when a checkbox is populated in an account and create a child record (populating the lookup and some fields on the child object) and on another instance, I'd like it to trigger when a certain value is selected from a picklist, creating a child record of the account and populating fields in both the account & child object.

 

Any ideas would be amazing!

 

Thanks.

  • March 17, 2013
  • Like
  • 0

Hello,

 

I recently tried deploying a change set from my sandbox to a production org (trigger as follows):

 

trigger AutoCreateRecord on Account (after insert) {
List<Record__c> Record= new List<Record__c>();
//For each Account record created, add a new record

//Note that Trigger.New is a list of all the new records

for (Account newAccount: Trigger.New)
{
if(
  newAccount.ispersonAccount == True &
  newAccount.Record_Required__c == True)
{
Record.add(new Record__c(Customer_name__c = newAccount.Id, Record_Status__c = 'Sent'));
}
}
insert Record;
}

 

This has worked well in the sandbox. However, I have since learned that I need to obtain test coverage of 75% of more for it to be used in production. I am new to apex and do not know how to do this. Any ideas would be appreciated, as the guides I've seen have been a bit beyond me!

 

Thanks!

  • March 21, 2013
  • Like
  • 0

Hi,

 

I am a newbie when it comes to apex and could do with some guidance. Basically, I am trying to create two different triggers, each firing under different scenarios.

 

On the first instance, I'd like a trigger which would fire when a checkbox is populated in an account and create a child record (populating the lookup and some fields on the child object) and on another instance, I'd like it to trigger when a certain value is selected from a picklist, creating a child record of the account and populating fields in both the account & child object.

 

Any ideas would be amazing!

 

Thanks.

  • March 17, 2013
  • Like
  • 0