You need to sign in to do that
Don't have an account?
laxmi narayan 11
Update Campaign Status from another object Status using trigger
Hi there,
I have a object Campaign_Follow_Up_Stage__c ,on this object i have a Campaign Lookup.
* On Campaign_Follow_Up_Stage__c object, i have a status field, when i insert or update record,if status = "Planned" , It changed the Campaign Field status into "In-Progress",If if status = "Draft" , It changed the Campaign Field status into "Planned" and if status = "Compelete" , It changed the Campaign Field status into "Compelete".
I wrote this:-
trigger updateCampaignStatus on Campaign_Follow_Up_Stage__c (after Update,after insert) {
set<Id> campIds = new set<Id>();
for(Campaign_Follow_Up_Stage__c c : trigger.new){
if(c.Status__c == 'Planned'){
campIds.add(c.id);
}
}
List<Campaign> cmList = [SELECT id, status FROM Campaign WHERE id In :campIds];
for(Campaign cm : cmList){
cm.status = 'In Progress';
}
update cmList;
}
Any help appreciated!
Thanks
L.N
I have a object Campaign_Follow_Up_Stage__c ,on this object i have a Campaign Lookup.
* On Campaign_Follow_Up_Stage__c object, i have a status field, when i insert or update record,if status = "Planned" , It changed the Campaign Field status into "In-Progress",If if status = "Draft" , It changed the Campaign Field status into "Planned" and if status = "Compelete" , It changed the Campaign Field status into "Compelete".
I wrote this:-
trigger updateCampaignStatus on Campaign_Follow_Up_Stage__c (after Update,after insert) {
set<Id> campIds = new set<Id>();
for(Campaign_Follow_Up_Stage__c c : trigger.new){
if(c.Status__c == 'Planned'){
campIds.add(c.id);
}
}
List<Campaign> cmList = [SELECT id, status FROM Campaign WHERE id In :campIds];
for(Campaign cm : cmList){
cm.status = 'In Progress';
}
update cmList;
}
Any help appreciated!
Thanks
L.N
If it solves your issue please mark as correct so it can help others asking the same.
Good luck!
All Answers
If it solves your issue please mark as correct so it can help others asking the same.
Good luck!
Thank you soo much.
Thanks
L.N