You need to sign in to do that
Don't have an account?
Vianney Bancillon 8
Error: Erreur de compilation : Field is not writeable: Opportunity.CreatedDate à la ligne 21 colonne 17
Hi Everyone,
I'm trying to write a simple test class.
My code gives the said error.
In my mind, at the line 21, I don't write an update on the CloseDate field but just a condition (boolean).
What is wrong in the following code?
Thanks for your help!
I'm trying to write a simple test class.
My code gives the said error.
In my mind, at the line 21, I don't write an update on the CloseDate field but just a condition (boolean).
What is wrong in the following code?
@istest public class batchOppBisTest { static testMethod void validateBatch(){ //création d'une nouvelle opportunité qui répond aux critères du workflow Opportunity opp1 = new Opportunity (Name = 'opptyDeTest', CloseDate = date.TODAY()+45, Engagement_date_finalisation_commande__c = date.TODAY()-1, StageName='Au planning de livraison'); insert opp1; //vérification que Nbre de jours avant finalisation a été calculé System.debug ('$$$ Nbre de jours avant finalisation' + opp1.Nbre_Jours_Avant_Finalisation__c); //requête sur opportunités Opportunity [] tabOpp = [SELECT StageName, CreatedDate FROM Opportunity WHERE StageName = 'Au planning de livraison']; Opportunity [] oppCreated = new Opportunity []{}; for (Opportunity o : tabOpp){ if (o.CreatedDate = date.Today()){ oppCreated.add(o); System.debug(o); }//if }//for }//validateBatch }//class
Thanks for your help!
on line no 20
All Answers
on line no 20