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

apex class test data - Issue
Hi,
I have a requirement where I need to display opportunities which are not worked upon for more than 15 days.
I need to show them.
I have created the class.
But for test class, I am facing an issue. If I insert test data in to the opportunity object. The last modified date would be the current date.
So there wont be any records which are satistying my criterion (without action for more than 15 days).
And code coverage is not happening properly.
Also "LastModifiedDate" field is not updateable.
Moreover if query the system for data without creating test data, we might not have any opportunities without any activity for more than 15 days.
Please suggest me if any one knows any means to tackle this issue.
Thanks,
JBabu.
For this you can have some formula field which can have same as lastmodified date and use that field in your test class.
Please mark this as solved if above is what you need
All Answers
For this you can have some formula field which can have same as lastmodified date and use that field in your test class.
Please mark this as solved if above is what you need
Thanks a lot Abhay.
Just wanted to know if there could any possible solution without having to create new field.
Thanks,
JBabu.
Hi
The thing is we can not change system fields nor we can have any such dataso for code covarege we need to do this kind of workaround
Ok, thank you Abhay.