+ Start a Discussion
SwerzSwerz 

Triggers do not fire

Hi Guys,

 

I wrote an 'after insert, after update' trigger on Opportunity, which updates a field(say, A) in Opportunity depending on the value of another field(say, B)  on Opportunity. Now when I convert a lead, the opportunity gets created but the value of A doesn't update, though the value of B is flowing from Lead itself ie B is populated but the trigger doesn't fire resulting in no population of A.

 

Could anyone of you help me overcome this?

 

Thanks 

OnkiOnki

what error you are getting?

SwerzSwerz
I do not get any error...the field just does not populate.
dhooftdhooft

Swerz,

 

I suppose you already tested it when creating a Opportunity manually and found out it worked ok then? 

For Opportunities they changed the behavour in saving in the spring release, so depending on the field you are refering in your trigger it may or may not work. See spring09 release notes:

 

https://na2.salesforce.com/help/doc/en/salesforce_spring09_release_notes.pdf

SwerzSwerz

Hi Dhooft,

 

thanks. You are right, I tested my trigger and it works fine if I manually create an Opportunity.

 

About the Spring release features, I guess, they are mostly about the child records and save behaviour if some change made to child records should be in sync with Parent record too.

 

My case is a bit similar to something I observed while converting a lead. Suppose a field X is mandatory on Opportunity. When we try to convert a lead, the resulting Opportunity gets created even without the field X being populated. The next time you try to edit and save the Opportunity though, it will give an error, that X is mandatory.

 

Actually, I tried making B mandatory in my case, hoping that  it would trigger my trigger but the opportunity was created without the mandatory field being populated.

 

 

SwerzSwerz
I am sorry. I tried making 'A' mandatory, not 'B' as I mentioned in the previous post.
BritishBoyinDCBritishBoyinDC
Just to confirm you have this set - Under Leads - Conversion Settings, there is a checkbox called 'Enforce Validation and Triggers from Lead Convert'. It isn't even visible by default - you have to request it from support. If this isn't visible/checked, any triggers on Opportunity or Contact don't execute.
Message Edited by BritishBoyinDC on 07-09-2009 10:05 AM
SwerzSwerz

Hi Pal,

 

this might just be what I want!! But I do not see the option i nmy org. Could you pls tell me who to contact to get it done? I am an admin though. Is there any config change required?

 

Thanks 

BritishBoyinDCBritishBoyinDC

Just raise a case using the normal support route, and request that they enable "Enforce Validation and Triggers from Lead Convert" in the Lead Settings section.

 

Once it is enabled, a new checkbox will appear - check that, and any insert triggers on Contact,Account and Opportunity should then fire when a lead is converted...