Perform ‘Right To Be Forgotten’ with Hub-Spoke Orchestration

Updated on March 20, 2023

Quick Steps to perform RTBF with Hub-Spoke Orchestration are as follows – 

Prerequisites  – Spoke Configuration in Hub org should have been validated and synced.

Step 1 – Create Hub Request –

Post Call URL-

/services/apexrest/cchub/v1/hub/createRTBF


Body – 

{
"nameValuePair": {
"LastName": "test",
"FirstName": "test",
"email": "test@test.com",
"phone": "111222333"
},
"externalDSARNumber": "EXT999",
"requestedOn": "2021-10-31T23:59:59.000Z",
"verifiedOn": "2021-10-31T23:59:59.000Z"
}

Required Parameter –

nameValuePair – mandatory

externalDSARNumber – optional

requestedOn – optional

verifiedOn – optional

Step 2 – Create Spoke Request – 
Execute the below command through the developer console.

cchub.HubSchedulableService.scheduleRequestIntitateBatch(null,null);

Step 3 – Status Update -> Spoke Request(Hub) and Hub Request (Hub) – 
Execute the below command through the developer console.

cchub.HubSchedulableService.scheduleStatusRequestBatch(null,null);

Step 4 – Retry Logic/Error – 
Execute the below command through the developer console.

cchub.HubSchedulableService.scheduleRetryBatch(null,null);

RTBF process – Hub-Spoke Orchestrator in detail – 

To perform RTBF on any user’s request, create a Hub Request in Hub Org using RTBF Hub Request API as shown below. Pass the necessary information in the POST method body so Privacy-Security Hub will process the request and will create an appropriate Hub Request record.

Note: You can create Hub Request records manually through the Salesforce UI.

Navigate to a REST tool such as Workbench, Postman, Insomnia, etc. (This example uses Salesforce Developer Workbench)

Select the radio button POST and put the below URL in the URL box.

POST URL –

/services/apexrest/cchub/v1/hub/createRTBF

Request Body – Add all the necessary details in the request body related to the record that the user wants to perform the RTBF on.

{
"nameValuePair": {
"LastName": "test",
"FirstName": "test",
"email": "test@test.com",
"phone": "111222333"
},
"externalDSARNumber": "EXT999",
"requestedOn": "2021-10-31T23:59:59.000Z",
"verifiedOn": "2021-10-31T23:59:59.000Z"
}


Click on the “Execute” button and the user will get a response with the Hub Request Number. 


Users can give NameValuePair formats and data types as follows – 

Date:- “Birthdate":"1994-06-14"

Date and Time:- “Login_Date_and_Time__c”:”2021-12-15T00:00:00.000Z”

Time:- “Submission_Time__c”:”00:00:00.000Z"

Percentage :- “Percentile__c":10

Number:- "Passport_Number__c":123456789

Text:- “LastName”:”Wood”

Now go to the salesforce and open the Hub Request record. You will find all the necessary details on the details page like

Status = Open,  Type = RTBF, Data Subject Identifier = {"LastName":"Wood","Email":"markwood10@gmail.com“}


Initially, all other sections and fields will show no records or details.


Now run command 2 through the developer console.

Command 2-

cchub.HubSchedulableService.scheduleRequestIntitateBatch(null,null); 

Note – The user can schedule this command using cron expressions

To execute the command, click on the gear symbol in Salesforce org and click on “Developer Console”.


Open the anonymous window in the developer console, put the command in the window, and click on the “Execute” button.


Once you click on the “Execute” button, all the processes within this command will get executed one by one as follows – 

  • It will create “Spoke Requests” records. You can find all the newly created “Spoke Request” records in the related list of the respective “Hub-Request” records.
  • Based on the SOQL/where clause in the “Hub-Spoke Objects” record it will fetch the Data Subject Ids from each of the spoke org. Those Data Subject Id records will be stored in the respective “Spoke Requests” records. 
  • With all the necessary inputs gathered in the “Spoke Requests” record, Privacy-Security will trigger the Spoke API (RTBF/Portability). Here the actual operations for RTBF and Portability take place in Spoke org and the user gets a case Id and status for all the “Spoke Requests” on the “Hub Request” record.  This will include success as well as errors for any record processing from any Spoke org along with the possible reason for an error message in respective “Spoke Requests”.
     

Now go to the “Hub Request” record and check the “Spoke Requests” section. You will find all the “Spoke Requests” from all the Spoke Orgs that are connected to the Hub Org. Also, the Spoke case Id with the record link with the status “In Progress”.

Now run Command 3 which further includes a few processes.

Command 3-

cchub.HubSchedulableService.scheduleStatusRequestBatch(null,null);
  • Initially, this command was used to fire the GET spoke API which contains all the details about the case and the initial status of the operation. 
  • After the above operation, the next process gets started and after execution, you can see the final status for the record in Hub org. For all the successful spoke requests, the status will be “Processed” for both the operations (RTBF/Portability) and in the “Sub-Status” field, for successful RTBF operations “Sub-Status” will be “Processed” and for successful Portability operations, “Sub-Status” will be “Attachment Generated”.

Note: In the case of Portability, you can find the generated JSON file in the related list of Hub-Spoke requests as well as the respective “Spoke Request” records.

Open the anonymous window in the developer console, put the command in the window, and click on the execute button.

You can then see the change in status and “Sub-Status” of the respective “Spoke Request” record. 

In this way, you process RTBF requests from Hub org to multiple Spoke orgs.

In case of Error and Retry – 

In case any Hub Request record fails while processing RTBF/Data Portability, In that case, “Retry Now” button will appear on that particular Hub Request record detail page.  Once you solve the problem at spoke org, then you can click on the “Retry Now” button and it will edit the Status of Errored records of Hub Request & Spoke Request so that these records based on their statuses will be picked by Command 2 and then command 3 on the next schedule.


If working on multiple or Bulk HubRequest “Errored” records, then via Data Loader edit the field ‘cchub__Retry__c’ = True and then execute the command 4.
 

Command 4: 

cchub.HubSchedulableService.scheduleRetryBatch(null,null);

The command is used to edit the status of all Errored records of Hub Request & Spoke Request and changes it to “Open”. Once you solve the problem at the Spoke org, these records based on their statuses will be picked by Command 2 and then Command 3 on the next schedule.

Status Transition – Hub Request & Spoke Request 
 

HUBMeaning
Level StatusSub StatusError message
HUB RequestOpenNULL No Spoke Request records. Processing has not started yet
In ProgressNULL Once all Spoke Request records are created. In Processing
ErrorNULLIncorrect JSON(Hub Request JSON wrong/ One or more Spoke Request records in error)
ProcessedNULL All Spoke Request records processed with no error
 SPOKE RequestOpenNULL If Spoke PrivSec Id Is Null
In ProgressNULL If Spoke PrivSec Id Is Not Null
New If PrivSec  Status=New
Validated If PrivSec =Validated
Records Generated if PrivSec Status=Record Generated
ErrorToo Many Records Found When one or more records found of the same name-value pair
Incorrect MappingMapping does not exist or is inactiveIncorrect mapping name,  Mapping is inactive
Missing ParametersMandatory parameter XXXX is missing 
Exception JWT user does not has access to the Field of a particular object
Record Not FoundIf based on the name-value pair, no record is foundNot found any record of the given name-value pair
ProcessedInsufficient Information Not enough information to call an org(handled by Batch1 in Hub itself)
Processed In RTBF, If Spoke Org returns PrivSec Status as Processed
Attachments Generated In Portability, If Spoke Org returns PrivSec Status as Processed
Record Not Found Not found any record of the given name-value pair