Perform 'Right To Be Forgotten' with Hub-Spoke Orchestration
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
| HUB | Meaning |
| Level | Status |
| HUB Request | Open |
| In Progress | NULL |
| Error | NULL |
| Processed | NULL |
| SPOKE Request | Open |
| In Progress | NULL |
| New | |
| Validated | |
| Records Generated | |
| Error | Too Many Records Found |
| Incorrect Mapping | Mapping does not exist or is inactive |
| Missing Parameters | Mandatory parameter XXXX is missing |
| Exception | |
| Record Not Found | If based on the name-value pair, no record is found |
| Processed | Insufficient Information |
| Processed | |
| Attachments Generated | |
| Record Not Found |
