You need to sign in to do that
Don't have an account?
Gaurav Agnihotri
Trigger doesn't fire when a field is removed from the page layout
Gurus,
I encountered a very strange problem. Below is my simple trigger. It looks for a lookup field custom field "Pelco_Account_Name__c " on quote object and if it null then populated the value of AccountId
Any comments/suggestions?
Thanks,
Gaurav
I encountered a very strange problem. Below is my simple trigger. It looks for a lookup field custom field "Pelco_Account_Name__c " on quote object and if it null then populated the value of AccountId
trigger updateOpptyAccount on Quote (before insert) { for (Quote QuoteInLoop : Trigger.new){ // if(QuoteInLoop.Opportunity.name != '.'){ Boolean sMainAccount=QuoteInLoop.Main_Account__c; String sMainAccountId=QuoteInLoop.AccountId; String sQuoteAccountId=QuoteInLoop.Pelco_Account_Name__c; String sQuotePriceBook=QuoteInLoop.PriceBook2Id; String sQuoteId=QuoteInLoop.Id; String sOptyId=QuoteInLoop.OpportunityId; //checking if price book is attached to the quote //if no price book exist than defaulting the standard price book if(sQuotePriceBook == null) { QuoteInLoop.Pricebook2Id =[SELECT Id FROM Pricebook2 Limit 1].Id; } //if pelco quote account is null if (sQuoteAccountId == null) { QuoteInLoop.Pelco_Account_Name__c=QuoteInLoop.AccountId; sQuoteAccountId=QuoteInLoop.AccountId; } }//closing forLoop }//closing trigger updateOpptyAccountThis trigger does not work if I remove AccountName field from the quote page layout. As soon as I put the field back it works. I disable all the workflow rules and approval, still the problem persist.
Any comments/suggestions?
Thanks,
Gaurav
All Answers