• Box @ Home
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 7
    Replies
Hello.  I am writing a trigger which does the following: when Account ownership is changed, query all associated Notes, Open Activities, Contacts (and related Notes and Open Activities), and Open Opportunities (and related Notes and Open Activities) - and change the ownership of all of those records.  I'm concerned that in some rare cases I may be updating more than 100 records as a result of this.

So my question: If i divide this functionality into three triggers - one which does Account Notes and Open Activities, a second trigger which does related Contacts (with Notes and Activities), and a third which does Opportunities (with Notes and Activities) - will this help?   Or will the platform calculate the sum of the records being processed by all three triggers?

Thanks
Chris
  • July 30, 2008
  • Like
  • 0

I want to remind task owner (through e-mail) 2 days before a task is due.
I want to send them another e-mail when the task becomes due (on due date).
Finally I want to send them yet another e-mail if task is overdue by more than 2 days.

Workflow rules on tasks do NOT allow creation of e-mail alerts.

How do I do this?

Salesforce has "Reminder popups" - but this works only if the user logs into the app!






Hi
 
New to this and confused.  Have a trigger for after insert/update on opportunities but cannot get the unit testing passed due to closedate being a required field.  no matter what format i use, the same error always is returned - namely: REQUIRED_FIELD_MISSING [CloseDate]: Close Date.
 
Please could someone assist - what should i put closedate = to?
 
Thanks
  • June 13, 2008
  • Like
  • 0
Hi All,

I have got an error in a trigger. I am running a very simple Test Class that change the name of an account:
public class InstertContact {
static testMethod void myTest() {
Account ac= [Select Name from Account where IB_Code__c = 'AA'];
a.Name = 'Test';
System.debug(ac);
update ac;
}

}
I have a trigger that is launch each time an account is updated and modifie the contacts that match with the criteria in the select:
trigger AccountAfterUpdate on Account (afterupdate) {
for(Account loopAccount : Trigger.New) {
String Ibcode = loopAccount.IB_Code__c;
List<Contact> matchingContacts = [Select c.LastName From Contact c where c.Introducing_Broker__c='AA'];
System.debug(matchingContacts);
for(Contact loopContact : matchingContacts ){
loopContact.IB_Code__c = 'aaa';
}
}
}
However this is the error I have got:

System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, AccountAftterUpdate: execution of AfterUpdate

caused by: System.QueryException: Non-selective query against large object type (more than 100000 rows). Consider an indexed filter or contact salesforce.com about custom indexing.
Even if a field is indexed a filter might still not be selective when:
1. The filter value includes null (for instance binding with a list that contains null)
2. Data skew exists whereby the number of matching rows is very large (for instance, filtering for a particular foreign key value that occurs many times)

Trigger.AccountAfterUpdate: line 4, column 14

I don't really understand what is the problem. Someone can help me in solving this?

thanks!
How to get session id in an Apex Trigger code ?
  • June 12, 2008
  • Like
  • 0