• lcefalo
  • NEWBIE
  • 0 Points
  • Member since 2012

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

 

Hi All,

 

I am getting an error and I cant see what in the APEX Trigger is cauing the error in the vlaidation rule.

 

Error: Invalid Data. 
Review all error messages below to correct your data.
Apex trigger Contact_Opportunity_Synch caused an unexpected exception, contact your administrator: Contact_Opportunity_Synch: execution of AfterUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id 0067000000NfCxeAAF; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Number of Contacts Purchased, NetProspex Product, Seats Purchased & Industry are required for any stage greater or equal to Proposal. THIS REPLACES THE CLOSED WON WIZARD!: []: Trigger.Contact_Opportunity_Synch: line 43, column1

 

here is the validation rule:

AND ( 
OR ( 
ISPICKVAL( StageName, "Proposal / TOS"), 
ISPICKVAL( StageName, "Closing Stage"), 
ISPICKVAL( StageName, "Closed Won")),OR( 
ISBLANK( of_Contacts_Purchased__c ), 
ISBLANK(TEXT( Industry__c )), 
ISBLANK(TEXT( NetProspex_Product__c)), 
ISBLANK( Seats_Purchased__c ) 
))

 

And thenthe APEX Trigger:

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52

trigger Contact_Opportunity_Synch on Contact (after update) {

  Map <Id, Contact> ContactMap = new Map <Id, Contact>();

  for(Contact c : Trigger.New) {
    if(c.title != Trigger.OldMap.get(c.id).title
     ||c.phone != Trigger.OldMap.get(c.id).phone
     ||c.Email != Trigger.OldMap.get(c.id).Email
     ||c.MailingCity != Trigger.OldMap.get(c.id).MailingCity
     ||c.MailingState != Trigger.OldMap.get(c.id).MailingState
     ||c.MailingStreet != Trigger.OldMap.get(c.id).MailingStreet
     ||c.MailingCountry != Trigger.OldMap.get(c.id).MailingCountry
     ||c.MailingPostalCode != Trigger.OldMap.get(c.id).MailingPostalCode
    ) {
         ContactMap.put(c.id, c);
    }
    
  }
  
  List <Opportunity> OppsToUpdate = new List <Opportunity>();
  
  for(Opportunity o : [Select id, primary_contact__c,Primary_Contact_Title__c,Primary_Contact_Email__c,Primary_Contact_Phone__c,Primary_Mailing_City__c,Primary_Mailing_Country__c,Primary_Mailing_State__c,Primary_Mailing_Street__c,Primary_Mailing_Zip__c from Opportunity where primary_contact__c in :ContactMap.keySet() and isClosed = false]) {
        
      o.Primary_Contact_Title__c = ContactMap.get(o.Primary_Contact__c).title;
          o.Primary_Contact_Email__c = ContactMap.get(o.Primary_Contact__c).email;
          o.Primary_Contact_Phone__c = ContactMap.get(o.Primary_Contact__c).phone;
          o.Primary_Mailing_City__c  = ContactMap.get(o.Primary_Contact__c).MailingCity;
          o.Primary_Mailing_Country__c = ContactMap.get(o.Primary_Contact__c).MailingCountry;
          o.Primary_Mailing_State__c = ContactMap.get(o.Primary_Contact__c).MailingState;
          o.Primary_Mailing_Street__c = ContactMap.get(o.Primary_Contact__c).MailingStreet;
          o.Primary_Mailing_Zip__c = ContactMap.get(o.Primary_Contact__c).MailingPostalCode;
    
      OppsToUpdate.add(o);
      
      if(OppsToUpdate.size() == 200) {
        update OppsToUpdate;
        OppsToUpdate.clear();
      }
    
  }

  if(OppsToUpdate.size() > 0)
    update OppsToUpdate;








}

Any help would be appreciated!!

Thanks,

Leif

 

Hi All, I created a custom button to update a couple of fields under the lead object.  While the button actually does update the fields when it refreshes the screen I get the URL no longer exists error.

 

Here is my code: https://na5.salesforce.com/{!Lead.Id}/e?retURL={Lead.Id}&lea13=Open&00N70000002TcQi=SAL&save=X

 

Any help would be appreciated.

 

Thanks!

 

Hi All,

 

I am getting an error and I cant see what in the APEX Trigger is cauing the error in the vlaidation rule.

 

Error: Invalid Data. 
Review all error messages below to correct your data.
Apex trigger Contact_Opportunity_Synch caused an unexpected exception, contact your administrator: Contact_Opportunity_Synch: execution of AfterUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id 0067000000NfCxeAAF; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Number of Contacts Purchased, NetProspex Product, Seats Purchased & Industry are required for any stage greater or equal to Proposal. THIS REPLACES THE CLOSED WON WIZARD!: []: Trigger.Contact_Opportunity_Synch: line 43, column1

 

here is the validation rule:

AND ( 
OR ( 
ISPICKVAL( StageName, "Proposal / TOS"), 
ISPICKVAL( StageName, "Closing Stage"), 
ISPICKVAL( StageName, "Closed Won")),OR( 
ISBLANK( of_Contacts_Purchased__c ), 
ISBLANK(TEXT( Industry__c )), 
ISBLANK(TEXT( NetProspex_Product__c)), 
ISBLANK( Seats_Purchased__c ) 
))

 

And thenthe APEX Trigger:

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52

trigger Contact_Opportunity_Synch on Contact (after update) {

  Map <Id, Contact> ContactMap = new Map <Id, Contact>();

  for(Contact c : Trigger.New) {
    if(c.title != Trigger.OldMap.get(c.id).title
     ||c.phone != Trigger.OldMap.get(c.id).phone
     ||c.Email != Trigger.OldMap.get(c.id).Email
     ||c.MailingCity != Trigger.OldMap.get(c.id).MailingCity
     ||c.MailingState != Trigger.OldMap.get(c.id).MailingState
     ||c.MailingStreet != Trigger.OldMap.get(c.id).MailingStreet
     ||c.MailingCountry != Trigger.OldMap.get(c.id).MailingCountry
     ||c.MailingPostalCode != Trigger.OldMap.get(c.id).MailingPostalCode
    ) {
         ContactMap.put(c.id, c);
    }
    
  }
  
  List <Opportunity> OppsToUpdate = new List <Opportunity>();
  
  for(Opportunity o : [Select id, primary_contact__c,Primary_Contact_Title__c,Primary_Contact_Email__c,Primary_Contact_Phone__c,Primary_Mailing_City__c,Primary_Mailing_Country__c,Primary_Mailing_State__c,Primary_Mailing_Street__c,Primary_Mailing_Zip__c from Opportunity where primary_contact__c in :ContactMap.keySet() and isClosed = false]) {
        
      o.Primary_Contact_Title__c = ContactMap.get(o.Primary_Contact__c).title;
          o.Primary_Contact_Email__c = ContactMap.get(o.Primary_Contact__c).email;
          o.Primary_Contact_Phone__c = ContactMap.get(o.Primary_Contact__c).phone;
          o.Primary_Mailing_City__c  = ContactMap.get(o.Primary_Contact__c).MailingCity;
          o.Primary_Mailing_Country__c = ContactMap.get(o.Primary_Contact__c).MailingCountry;
          o.Primary_Mailing_State__c = ContactMap.get(o.Primary_Contact__c).MailingState;
          o.Primary_Mailing_Street__c = ContactMap.get(o.Primary_Contact__c).MailingStreet;
          o.Primary_Mailing_Zip__c = ContactMap.get(o.Primary_Contact__c).MailingPostalCode;
    
      OppsToUpdate.add(o);
      
      if(OppsToUpdate.size() == 200) {
        update OppsToUpdate;
        OppsToUpdate.clear();
      }
    
  }

  if(OppsToUpdate.size() > 0)
    update OppsToUpdate;








}

Any help would be appreciated!!

Thanks,

Leif

 

Hi All, I created a custom button to update a couple of fields under the lead object.  While the button actually does update the fields when it refreshes the screen I get the URL no longer exists error.

 

Here is my code: https://na5.salesforce.com/{!Lead.Id}/e?retURL={Lead.Id}&lea13=Open&00N70000002TcQi=SAL&save=X

 

Any help would be appreciated.

 

Thanks!