If the id is created but not inserted then at the end of your transaction the id is discarded if not inserted. Check your logs and try to catch exceptions if there are.
OpportunityLineItemSchedule sch = [SELECT Id FROM OpportunityLineItemSchedule WHERE Id = '00o4H000003lxWbQAI' ALL ROWS];
try {
undelete sch;
} catch (DmlException e){
System.debug(e);
}
Error: System.QueryException: List has no rows for assignment to SObject
Ok I got this error because I used single OpportunityLineItemSchedule object. If I use list I get no error and debug log doesn't print anything and still that record is not existant
Well that's what I'm asking. Code that being executed is a bit messy so it's hard to follow. But still I shouldn't get that error if record is non existant.
Are you performing that delete inside a trigger or a regular apex class? Once you are ready to formalize this question technically speaking, consider to post your question on salesforce stack exchange, but you have to specify a lot of details (not the actual code necessary) since this issue seems to be a little tricky and referred to that package. The steps you provide are not enought to know where your code has troubles, are you able to reproduce the error with other ids?
Performing delete inside the trigger. I don't know how can I replicate with other ids, the record is not there and I don't know other record ids because they do not exist. Cheers thanks for your help!
So if you perform an undelete action on that record what's the error message?
try:
Error:
System.QueryException: List has no rows for assignment to SObject
- Code tries to figure out opportunity that is being amended
- Then queries opportunity line items and product schedules
- Then checks if product schedule date is > then new product start date
- If so it adds all schedules to the list and deletes them
This is very short version of the logic. I get that error on delete. Let me know if more details are necessaryOnce you are ready to formalize this question technically speaking, consider to post your question on salesforce stack exchange, but you have to specify a lot of details (not the actual code necessary) since this issue seems to be a little tricky and referred to that package.
The steps you provide are not enought to know where your code has troubles, are you able to reproduce the error with other ids?
I don't know how can I replicate with other ids, the record is not there and I don't know other record ids because they do not exist.
Cheers thanks for your help!