+ Start a Discussion
GaneeeshGaneeesh 

how to undelete record using soql query..?

Is any one help me how to undelete record using soql query..? 

I am using this query "Contact[] c = [select id from contact where isDeleted = true LIMIT 1000 ALL ROWS];
undelete c;"
When i use this query I am getting this error "System.DmlException: Undelete failed. First exception on row 0 with id 00390000019TLhkAAG; first error: UNDELETE_FAILED, Entity is not in the recycle bin: []".

Can any one help how to undelete records using soql query.?
 
Frédéric TrébuchetFrédéric Trébuchet
Hi,
Your code is good.
You have to know that in certains circumstances, some records may respond to the query with "isDeleted = true" but can't be undeleted because physically not in the recycle bin.

Hope this helps,
Fred
 
Frédéric TrébuchetFrédéric Trébuchet
Hi,

Does this answer help you solved your problem?
If so, mark the question as Solved and kindly select the best answer.

Thanks,
Fred