Salesforce: Bulk update content authors using the Salesforce Developer Console

When someone leaves the organization, Simpplr will deactivate them as per your SSO/HRIS system settings. However, their content will stay authored by them by default. 

You can use the Salesforce Developer Console to bulk update content authors as needed. To do so, you'll need to:

  1. Get the required ID numbers (both the original author and the new author's ID and the site ID)
  2. Update the data loader command with the IDs
  3. Run the command in the Salesforce Developer console

Note:

You must be a System admin to perform these actions. Once you gather the required IDs, we recommend pasting them in a space you'll remember, like the table below...

Paste collected IDs here:

oldAuthorProfileId  
newAuthorProfileId  
siteId  

 

Collect the required IDs

  1. First, get the "oldAuthorProfileId". To find this, go to the old author's profile in Simpplr. If the user has been deactivated, go to any piece of content authored by them and click their name to get to the profile.
    Change_author_bulk_1.gif
  2. The user's ProfileID will be visible as the numbers at the end of the URL on their profile. Copy the string of numbers and paste it in your table or location you can reference later.
    Change_author_bulk_2.png
  3. Now, get the "newAuthorProfileId". Navigate to the designated new author's profile and copy the numbers at the end of the URL. This will be the same action as you completed above. Paste the value in your table.
    Change_author_bulk_3.png
  4. Get the "siteId". Navigate to the site where the content lives. From the site dashboard, once again, you'll copy the string of numbers at the end of the URL. That is the siteId. Ignore the /dashboard portion after your string of numbers. Paste the value in your table. In our example, the site where the content lives is New Hire Onboarding.
    Change_author_bulk_4.png

Update the data loader command with the IDs

Use the query below to update the command. Copy this code snippet. You'll paste in into the Developer Console as instructed below. Be sure when you paste the code, you replace the highlighted numbers here with the IDs you collected.

String oldAuthorProfileId = 'a0w5e000000p2nVAAQ';

String newAuthorProfileId = 'a0w5e000000WGNcAAO';

String siteId = 'a145e000001JEHWAA4';

List<Simpplr__simpplr_content__c> contentList = [select id, simpplr__primary_author__c

                                                 from simpplr__simpplr_content__c 

                                                 where simpplr__site__c=:siteId

                                                 and simpplr__primary_author__c=:oldAuthorProfileId];

for(Simpplr__simpplr_content__c contentObj : contentList) {

    contentObj.simpplr__primary_author__c = newAuthorProfileId;
}
update contentList;

Paste the command into the Salesforce Developer Console

  1. Navigate to this URL, being sure to replace the highlighted portion with your intranet's base URL. https://baseURL.my.salesforce.com/_ui/common/apex/debug/ApexCSIPage
  2. Select Debug > Open Execute Anonymous Window.
    Change_author_bulk_5.png
  3. Paste the command with your correct IDs into the text editor. 
  4. Select Execute at the bottom corner of the text editor.
    Change_author_bulk_6.png
  5. The code executes in the background and will not give an indicator of completion. Changes should take effect within five minutes.
  6. Be sure to go back to Simpplr to verify the command worked as planned. In our example, the new author, Amber Rich, has taken ownership of every piece of content originally written by Nicole Kramer. 
    Change_author_bulk_7.png
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.

Articles in this section

See more