You need to sign in to do that
Don't have an account?
iswarya sekar 7
Hiii everyone!! I need to write test class for the apex trigger. Anyone Please Help me!!
trigger UpdateStage on Account (after insert, after update, before insert, before Update) { // Performs Custom actions after Record gets saved. DisableTriggers__c ab = DisableTriggers__c.getValues('UpdateStage'); if(ab.activate_Trigger__c ==TRUE){ List<Id> accountId = new List<Id>(); // get the list of all Account's ID to be Updated. for(Account acc : Trigger.new) { if(acc.All_Opportunities_Won__c==True) // Checks if the Condition is True. accountId.add(acc.Id); } List<Opportunity> oppsToUpdate = new List<Opportunity>(); for(Opportunity opp : [select id, StageName, Amount from Opportunity where AccountId in: accountId AND Amount != 0]) // used to get all records from above ID. { opp.StageName='Closed-Won'; //Update StageName in Opportunity oppsToUpdate.add(opp); } update oppsToUpdate; // Update all Opportunity in List. } }
Please check once below code :
Hope it helps you.
Thanks
Varaprasad
All Answers
Please check once below code :
Hope it helps you.
Thanks
Varaprasad
Im getting the error as " Illegal assignment from Id to Account "
Accountid = acc.id,