You need to sign in to do that
Don't have an account?

test class field is not writeable error
Order order1=new Order(); order1.AccountId=ac.Id; order1.EndDate=Date.newInstance(2019,07,25); order1.Pricebook2Id=priceBookS.Id; order1.EffectiveDate=Date.newInstance(2019,07,16); order1.Status='In'; order1.TotalAmount=1; order1.totaltransaction=1; //order1.Status='In'; insert order1;
my test class is this I have validation rule that is totalamount = totaltransaction so when i am running the test it is failing because of validation rule
But totalAmount field is not writeable and totaltransaction is rollup field
how can I insert the TotalAmount field in testclass
you may have to insert the related line item record with Amount field populated which will eventually populate the totalAmount on order.