function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Deanna Aaron 11Deanna Aaron 11 

QueryAll and call update() - What does this mean?

Hi,

I am trying to unarchive a record in Salesforce. I found two solutions online, but I don't understand the steps to take in order to unarchive the record.

Solution #1 Source: https://salesforce.stackexchange.com/questions/70860/how-to-unarchive-activities

Use queryAll in the API to retrieve the activities, then perform an update to the records. You only need to call update() using just records by Id value (you just "touch" the record). They will be restored upon saving.
The Data Loader exposes queryAll as "Export All."

OR

Solution #2 Source: https://help.salesforce.com/articleView?id=000199524&type=1

1.) Use Workbench or use any tool and select the option include Deleted and Archived records,which could use queryAll() method. The queryAll() method needs a connection setup as it can only be used via an API call. 
 2.) ALL ROWS is only intended for use in Apex SOQL queries. The documentation for ALL ROWS is in the Apex code documentation. The equivalent of ALL ROWS in the API is to call queryAll() instead of query(). You can't use that in Developer Console's Query Editor as the query editor doesn't execute it as Apex Code,it executes directly as a REST query API call.
3.) Salesforce Support can increase the archive period for your ORG, to retrieve more archived records.

Can you show images in how to solve this?
QueryAll() -- Am i supposed to put something in the ()?
Update() -- Again, do I put something in the ()?

Thank you very much for your help. I can't uninstall a specific package until this is fixed.
Best Answer chosen by Deanna Aaron 11
Glyn Anderson 3Glyn Anderson 3
Deanna,

You can access Workbench here:  https://workbench.developerforce.com/login.php.

Accept the terms of service and Login with your Salesforce credentials.
User-added image
In "Jump to:", select SOQL Query and pick your object (I'm using Event for my example).  Click "Select".
User-added image
Under "Deleted and archived records:", select "Include".  Pick the Id field and any other fields that will help you identify the record you are looking for.  (This is a multi-select list box.  Use Ctrl-Click on Windows or Command-Click on OSX to pick additional fields.)  Add the filter "IsArchived = true", as shown.  Click "Query".
User-added image
You should get a list of query results, like this:
User-added image
If you hover over the one you want, you will have the option to Update it.  Hover and click "Update".
User-added image
Continued in the next post...
 

All Answers

Glyn Anderson 3Glyn Anderson 3
Deanna,

You can access Workbench here:  https://workbench.developerforce.com/login.php.

Accept the terms of service and Login with your Salesforce credentials.
User-added image
In "Jump to:", select SOQL Query and pick your object (I'm using Event for my example).  Click "Select".
User-added image
Under "Deleted and archived records:", select "Include".  Pick the Id field and any other fields that will help you identify the record you are looking for.  (This is a multi-select list box.  Use Ctrl-Click on Windows or Command-Click on OSX to pick additional fields.)  Add the filter "IsArchived = true", as shown.  Click "Query".
User-added image
You should get a list of query results, like this:
User-added image
If you hover over the one you want, you will have the option to Update it.  Hover and click "Update".
User-added image
Continued in the next post...
 
This was selected as the best answer
Glyn Anderson 3Glyn Anderson 3
On the update screen, you don't have to change any values (but you can if you want to).  Click "Confirm Update".
User-added image
If the update is successful, your record should no longer be archived.
User-added image
Deanna Aaron 11Deanna Aaron 11

Thank you, Glyn! You get mega karma points for taking the time to lay this out. Unfortunately, the object I am using "product2" doesn't have "IsArchived" as a dropdown :(

Thanks anyway!

Glyn Anderson 3Glyn Anderson 3
Deanna,  Yes, Product2 is not archived.  Was the record deleted?  If it was deleted within the last 15 days, you should be able to undelete it from the Recycle Bin.
Deanna Aaron 11Deanna Aaron 11
Glyn - No, it was not deleted. It was 'Archived'.
Glyn Anderson 3Glyn Anderson 3
My mistake.  Products can be archived.  I found this article:  https://help.salesforce.com/articleView?id=000194055&type=1 (https://help.salesforce.com/articleView?id=000194055&type=1) that describes the process.  It appears to be irreversible.  Could you possibly recreate the Product?  Or maybe reinstall the package (to repair the installation) and then uninstall it?

Sorry for you predicament.  Let me know if you find a solution.  Have you opened a support ticket with Salesforce?