You need to sign in to do that
Don't have an account?
SeanSee
Case to Custom Object Trigger
I'm trying to create a trigger that will update a custom object that we have called a participant record anytime a user submits a cancellation case. The problem I'm running into is that we also use a custom object called programs and we've made a change so that multiple records use the same name. I am trying to use an if else statement and the division to differentiate the different program names.
Right now the trigger is not getting to the end to update the participant record but I'm not sure why. If anyone has any suggestions it would be a huge help.
trigger CancellationCaseTrigger on Case (before insert, before update) {
for (Case thiscase: System.Trigger.new) {
// DE-6 : Modifed Orignal Trigger to Only Cancel the Program specified on the Case Object
Participant__c[] Participants = [Select Id from Participant__c WHERE Account_del__c = :thiscase.AccountId AND Program__C = :progORsvc.id ];
for (Participant__c p : Participants) {
p.Cancellation_Case__c = thiscase.Id;
p.Program_Status__c = 'Cancelled';
p.Cancel_Date__c = thiscase.Program_End_Date__c;
p.Enrolled__c = 'No';
update p;
}
}
}
}}}}}}
Hi,
Could you please explain in detail what you are trying to achieve.
From your code its hard to understand it. Also for each condition you are written one SOQL statement. As a best practice you should write the bulk trigger, that will help you even if the data is loaded from data loader.
Please explain in detail what you want to achieve in detail so that we can help you.
We are currently using Cases to accept cancellations for recurring programs for clients. The process is:
Does this help at all? Thanks so much!
Hi Sean,
I will try to write a code for you then u can test it.
That's awesome thank you so much.
Hi Sean,
Do u have a skype id/gmail id?
Sorry, if u dont want u dont give, but here asking questions and interacting is real pain.
Dont knw when salesforce will come up with the chat room for developers. :D