We're using Schema.getGlobalDescribe().get(objectName).getDescribe().fields.getMap()
to fetch all the fields in Product2 and build a dynamic query. When the string is used in database.query() method, it throws the error below.
No such column 'IsArchived' on entity 'Product2'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.
The query works when I remove "IsArchived" field. Tried running the code in Execute Anonymous and I'm not getting the same issue. Query retrieves records even when 'IsArchived' is added.