I am writting a test method, where I have to set closedate
of a case record to an old date.
I know, i can make Status
to "closed
", but it will give you close date as Today.
Is there any other way, where I can set the close date to an old date?
I am writting a test method, where I have to set closedate
of a case record to an old date.
I know, i can make Status
to "closed
", but it will give you close date as Today.
Is there any other way, where I can set the close date to an old date?
Best Answer
You should be able to do this, and set other system date fields, using JSON.deserialize(). For example (setting CreatedDate):
Above example and further detail here: https://help.salesforce.com/apex/HTViewSolution?id=000181873&language=en_US