• greg521
  • NEWBIE
  • 0 Points
  • Member since 2012

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

Hi all,

Using the force.com enterprise edition, I wrote a bunch of triggers a while back for objects I hadn't deployed. When I wrote them they compiled, worked well, etc.

Recently I decided to deploy the objects I had created and suddenly all the triggers lost the "Is valid" check. As far as I can tell this is because the code coverage is at 0% and from the reading I've done I think I need unit tests of some kind, but I'm not sure how to do that or even how to edit the triggers at this point (The edit button is gone and I cannot create new triggers). Any advice would be greatly appreciated.

Thanks,

Greg

 

One such trigger is included here:

trigger google2 on Property__c (before update, before insert) {
    for(Property__c p : trigger.new){
        p.Google_Name__c = 'www.google.com/search?q=' + p.Name;
        p.Google_Address__c = 'www.google.com/search?q=' + p.Address__c;
        p.Google_Map__c = 'maps.google.com/?q=' + p.Address__c;
    
    }
}
  • September 13, 2012
  • Like
  • 0

Hi, 

I'm fairly new to Apex and I have a trigger that isn't working.

Basically, I have two objects of importance - a holder and a provider. The holder has a name field that I want to be automatically set to the name of the provider. so far I have:

 

trigger rename on Holder__c (before update, before insert) {
    for(Holder__c h : trigger.new){
           h.Name = h.Provider__c.Name;
     }
}

 

but i'm getting a weird error. any help would be greatly appreciated.

-greg

Hi all,

Using the force.com enterprise edition, I wrote a bunch of triggers a while back for objects I hadn't deployed. When I wrote them they compiled, worked well, etc.

Recently I decided to deploy the objects I had created and suddenly all the triggers lost the "Is valid" check. As far as I can tell this is because the code coverage is at 0% and from the reading I've done I think I need unit tests of some kind, but I'm not sure how to do that or even how to edit the triggers at this point (The edit button is gone and I cannot create new triggers). Any advice would be greatly appreciated.

Thanks,

Greg

 

One such trigger is included here:

trigger google2 on Property__c (before update, before insert) {
    for(Property__c p : trigger.new){
        p.Google_Name__c = 'www.google.com/search?q=' + p.Name;
        p.Google_Address__c = 'www.google.com/search?q=' + p.Address__c;
        p.Google_Map__c = 'maps.google.com/?q=' + p.Address__c;
    
    }
}
  • September 13, 2012
  • Like
  • 0

Hi, 

I'm fairly new to Apex and I have a trigger that isn't working.

Basically, I have two objects of importance - a holder and a provider. The holder has a name field that I want to be automatically set to the name of the provider. so far I have:

 

trigger rename on Holder__c (before update, before insert) {
    for(Holder__c h : trigger.new){
           h.Name = h.Provider__c.Name;
     }
}

 

but i'm getting a weird error. any help would be greatly appreciated.

-greg