You need to sign in to do that
Don't have an account?
rmranjith8881.3927046400771116E12
Trigger to affect all Households
Hi Everyone,
Iam dealing with one NGO Project.
If I want to change the start and finish dates on the campaign, can I do this so it effects all the HH's and Organizations?
if I decided my end date is 4/1/2014 instead of 3/1/2014, can I change this in one place that will effect all the fields on Households or Organizations?
Thanks in advance.............
Iam dealing with one NGO Project.
If I want to change the start and finish dates on the campaign, can I do this so it effects all the HH's and Organizations?
if I decided my end date is 4/1/2014 instead of 3/1/2014, can I change this in one place that will effect all the fields on Households or Organizations?
Thanks in advance.............
You can write a trigger as explained in the following forum post to update multiple records when a single field is updated on a related object:
I understand there must be a relationship between a campaign and Households or Organizations such that with the campaign ID we can pull up all the Households or Organizations related to it - if yes - this ID can be used in the SOQL to get the Households or Organizations and update the end date on these records.
https://success.salesforce.com/answers?id=90630000000haFOAAY please go through the code and modify as per your requirement.
Thanks for reply,
here campaign nothing but the date field(Rollup since),this filed there in household itself.
If i change the Rollup since date it will affect(update) all Households.
I created one batch apex class,its working fine for today(),
but whenever user changes the date,for that date i want to update all households,
here is my batch apex class:
global class batchHouseHoldUpdate implements Database.Batchable<sObject> {
global Database.QueryLocator start(Database.BatchableContext BC) {
String query = 'SELECT id,name,Rollup_ends__c,Rollup_Since__c from npo02__Household__c';
return Database.getQueryLocator(query);
}
global void execute(Database.BatchableContext BC, List<npo02__Household__c> hHList) {
for(npo02__Household__c hh : hHList) {
hh.Rollup_Since__c = date.today();
}
update hHList;
}
global void finish(Database.BatchableContext BC) {}
}
Can you tell me how do we do that?
Thanks in advance.............