0

I noticed that archived products don't get returned in soql. Is there a way to accomplish this?

Example query:

SELECT Id, IsArchived FROM Product2 WHERE Id = '01t50000001CQp6' AND IsArchived = true

This product is archived and I can view it in the UI

1 Answer 1

2

You need to add ALL ROWS to the query.. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_SOQL_query_all_rows.htm

2
  • I get an error of parsing error with queries SELECT Id, IsArchived FROM Product2 WHERE IsArchived = true ALL ROWS AND SELECT Id, IsArchived FROM Product2 ALL ROWS WHERE IsArchived = true Commented Jan 2, 2020 at 19:07
  • 1
    @TemporaryFix If you're using the Developer Console Query tab, you can't query those records. Try the Apex Data Loader or Workbench to perform a "queryAll" call, or use ALL ROWS when using Apex (e.g. Execute Anonymous).
    – sfdcfox
    Commented Jan 2, 2020 at 19:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .