You need to sign in to do that
Don't have an account?
Cprocessing
Update All Child Objects From Parent - What am i doing wrong?
trigger SigningLiveUpdate on Account (before update) { //Get accounts from Trigger Account account = trigger.new[0]; //If criteria in Account are met then proceed if(account.CustomerStatus__c = 'Approved') { //Create New Signing Array - I'm aware i could condense this step, but it's an attempt to make it work Signing__c[] allSignings = new Signing__c[0]; //Add all Signing__c objects that share that are related to the account allSignings = [select Live__c from Signing__c where Id =: account.Id]; //Go through each related Signing__c object and set them to live if(allSignings.size()>0) { for(Signing__c signing: allSignings){ signing.Live__c = true; //update signing; } } } // Update Signings update allSignings; }
Signing__c is a custom object that has a Master-Detail Relationship to Account.
Essentially all i want to do is when a the status in Account gets set to Approved i want all the signing objects to then get set to "Live"
This must be doable? What am i doing wrong guys?
CProcessing.
Hi Guys,
Sorry to clutter up your forum, i quite clearly forgot how to query a database when i wrote the above code.
I simple wasn't pulling out the signing objects based upon their relationship to the account, rather their own ID
All Answers
Hi Guys i've neatened my code a little, but still no joy.
For simplicity i've just set the conditional value to "true"
Hi Guys,
Sorry to clutter up your forum, i quite clearly forgot how to query a database when i wrote the above code.
I simple wasn't pulling out the signing objects based upon their relationship to the account, rather their own ID