• Susan Love 2
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 4
    Replies
We have fields on our Account page which total number of meetings via the Contract page.  This is run through scheduled batches.  Unfortunately we noticed the Apex code was incorrect as one of the totals was wrong.  I have corrected the code but the existing totals that were there have not changed.  Would I need to put all the totals in as 0 then let the batches run to enable the correct totals to appear?
HI

I have a trigger written that updates a field on the account page from the contract page but only for certain products.  I have this written as a list (in bold) but it is not picking up these products.  I have been told to change to a set but I am not familar with sets copy of trigger below can anyone help with this?

Trigger updateESPWorryDate on Contract (after insert, after update)
{
List<Contract> CL=trigger.new; 
List<Id> aid=new List<Id>(); 
for(Contract c: CL) 

aId.add(c.AccountId); 


list<Account> AL=new List<Account>(); 

for(Account a: [select Id from Account where Id in :aId]) 

List<Contract> ICL=[select Status, Sub_End_Date__c from Contract where AccountId=: a.Id]; 
String max='1900-01-01';
for(Contract c: ICL) 

List<String> productCodeList = new List<String>{'ESP-E-R','ESP-B-R', 'ESP-B-I', 'ESP-P-R', 'ESP-P-I', 'ESP-E-I'};
{
if(c.Status=='Activated' && c.Sub_End_Date__c !=null) 
if(Date.valueOf(max)<c.Sub_End_Date__c) 
max=String.valueOf(c.Sub_End_Date__c); 
}
if(max!='1900-01-01')
a.ESP_Worry_Date__c=Date.valueOf(max); 
AL.add(a); 
}
Set<Account> accountData = new Set<Account>(AL);
AL=new List<Account>(accountData);
if(AL.size()>0)
   update AL;
}
}
We have existing code in our org which had been written when we had one product, we now have three other products.  We require this code to be changed to include these other three products, code below:

List renewalProductList = [SELECT Id, Name, Descripton, ProductCode FROM Product2 WHERE ProductCode = 'SUBS-R'];

Can anybody help me change this code to enable it to recognise the other three products.

Thanks
Susan
 
We have fields on our Account page which total number of meetings via the Contract page.  This is run through scheduled batches.  Unfortunately we noticed the Apex code was incorrect as one of the totals was wrong.  I have corrected the code but the existing totals that were there have not changed.  Would I need to put all the totals in as 0 then let the batches run to enable the correct totals to appear?
HI

I have a trigger written that updates a field on the account page from the contract page but only for certain products.  I have this written as a list (in bold) but it is not picking up these products.  I have been told to change to a set but I am not familar with sets copy of trigger below can anyone help with this?

Trigger updateESPWorryDate on Contract (after insert, after update)
{
List<Contract> CL=trigger.new; 
List<Id> aid=new List<Id>(); 
for(Contract c: CL) 

aId.add(c.AccountId); 


list<Account> AL=new List<Account>(); 

for(Account a: [select Id from Account where Id in :aId]) 

List<Contract> ICL=[select Status, Sub_End_Date__c from Contract where AccountId=: a.Id]; 
String max='1900-01-01';
for(Contract c: ICL) 

List<String> productCodeList = new List<String>{'ESP-E-R','ESP-B-R', 'ESP-B-I', 'ESP-P-R', 'ESP-P-I', 'ESP-E-I'};
{
if(c.Status=='Activated' && c.Sub_End_Date__c !=null) 
if(Date.valueOf(max)<c.Sub_End_Date__c) 
max=String.valueOf(c.Sub_End_Date__c); 
}
if(max!='1900-01-01')
a.ESP_Worry_Date__c=Date.valueOf(max); 
AL.add(a); 
}
Set<Account> accountData = new Set<Account>(AL);
AL=new List<Account>(accountData);
if(AL.size()>0)
   update AL;
}
}
We have existing code in our org which had been written when we had one product, we now have three other products.  We require this code to be changed to include these other three products, code below:

List renewalProductList = [SELECT Id, Name, Descripton, ProductCode FROM Product2 WHERE ProductCode = 'SUBS-R'];

Can anybody help me change this code to enable it to recognise the other three products.

Thanks
Susan
 
Our company has 2 distinct products with 2 distinct websites (unique URLs).  We are trying to set up a web-to-lead form for each one of these sites so that the leads that are generated are correspondingly separated and we can set up 2 different custom reports, per product.  How do we do this?




Message Edited by bsamii on 08-18-2008 04:13 AM
  • August 18, 2008
  • Like
  • 0