Sync Recovery
The Sync Recovery functionality is intended to pass created, updated, or deleted records with errors from the CT Mobile app to Salesforce within the fast or mixed synchronization.
We recommend using the Sync Recovery functionality in case of sensitive data with dynamic user permission settings.
| Sync Recovery cannot be applied to the CT Orders objects. To learn more, refer to Order Change Manager. |
Activation
To activate the Sync Recovery functionality, make sure that the user profile has access:
-
In CT Mobile Control Panel
-
In CT Mobile Control Panel 2.0
-
Select the required profile in the Location picklist. To apply settings to all the profiles, select General Settings.
-
Drag and drop the required object from the Available list to the Selected list.
-
Enable the Sync Recovery setting.
-
Choose the Sync Recovery option from the drop-down list.
-
Click Save.
-
Select the required profile in the Profile picklist. To apply settings to all the profiles, select General Settings.
-
Move the required object from the Available list to the Selected list.
-
Choose the Sync Recovery option from the drop-down list.
-
Click Save.
The setup is complete.
Sync Recovery Options
Considering the following:
-
The selected Sync Recovery option will be checked for the object for which the error occurred.
-
Depending on object relationships:
-
If there is a master-detail relationship, the same Sync Recovery option should be applied for both objects, for example, Activity and Activity Data. The system checks which Sync Recovery option is selected for the parent object.
-
If there is a lookup relationship, Sync Recovery may be enabled for one or both objects. For example,Activity and Account.
-
If objects have no relationship, different Sync Recovery options may be enabled for each of them.
-
-
If an error has been caught on the Attachment record, the Sync Recovery option will be checked for its parent object.
-
Please note that the maximum size of the data to send via Sync Recovery is about 4.2 MB (including attachments, files, etc.) due to APEX limits.
Empty value
This option is set by default. Any occurred errors will not be processed and will be listed in the Errors menu item.
Direct access
This option is intended to push record changes directly to an object via the web service using Apex code in a system context.
-
The inaccessible records remain available for the user until the full synchronization will be performed.
-
The information about using the web service will be written in the Sync Log record.
Proxy object
This option is intended to save record changes as a JSON file attached to the Sync Log record. In Salesforce, you can apply the custom logic for JSON files.
-
If the operation during the sync process is complete, a pop-up displays the types and number of records hidden in the CT Mobile app due to a lack of permissions.
-
The information about using the web service will be written in the Sync Log record.
Web Service Errors
If errors occur during the sending of records via web service due to a violation of a validation rule or the incorrect response from the web service, error messages will be added to a Sync Log record, and records will be added to the Errors screen.
The server returns SyncRecovery is off error if neither the Direct access option nor the Proxy object option is set for the object. For example, if the Sync Recovery functionality was turned off on the Salesforce side after the last successful synchronization.
Error Processing
All types of errors trigger the Sync Recovery functionality.
-
The following errors will be processed according to the selected option:
-
INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY
-
INSUFFICIENT_ACCESS_OR_READONLY
These errors occur when the records are becoming unavailable for the user due to changes in the permissions adjustments.
-
-
Records with any other error will be processed according to the Proxy object option, even if the Direct access option is selected.
Records, excluding Attachments, will be processed using the Proxy object option if they match both criteria:
-
the Direct access option is selected for the object of records
-
records contain errors, for example, validation errors, a blank required field, a link to a record that is not present on the Salesforce side, etc.
Parameters of JSON File and Salesforce Response for the Proxy Object Option
A JSON file is attached to the Sync Log record:
{
"data" : {
"userId" : "005b0000001THg9AAG",
"action" : "update",
"errors" : {
"Account" : [ {
"errorMessage" : "insufficient access rights on object id",
"Id" : "0011w00000Ov2dCAAR",
"exceptionCode" : "INSUFFICIENT_ACCESS_OR_READONLY"
} ],
"Contact" : [ {
"exceptionCode" : "INSUFFICIENT_ACCESS_OR_READONLY",
"Id" : "0031w00000O9MnXAAV",
"errorMessage" : "insufficient access rights on object id"
} ]
},
"items" : {
"Account" : [ {
"attributes" : {
"type" : "Account",
"url" : "/services/data/v49.0/sobjects/Account/0011w00000Ov2dCAAR"
},
"IsTarget__c" : true,
"Id" : "0011w00000Ov2dCAAR"
} ],
"Contact" : [ {
"attributes" : {
"type" : "Contact",
"url" : "/services/data/v49.0/sobjects/Contact/0031w00000O9MnXAAV"
},
"Title" : "CTO",
"Id" : "0031w00000O9MnXAAV"
} ]
}
}
}
The JSON file parameters:
| Key | The name of the Attachment record, for example, RecoveryData_2019-12-06 10:53:16.log. |
|---|---|
data |
The description of the request. |
userId |
The current user ID. It is used to find the appropriate Sync Recovery option. |
action |
The type of operation:
|
items |
Records of parent and child objects. |
type |
The API Name or ID of records that are not accessible to the user. |
errors |
The API Name or ID of the object of the record with an error. |
errorMessage |
Text of an error message. |
ID |
The ID of the record with an error. In the case of the insert operation or if the web service didn’t return the ID of the record with an error, the value is empty. |
exceptionCode |
The parameters of Salesforce response:
| Key | Description |
|---|---|
keyValue |
The API Name of an object or ID of a parent record. |
success |
The status attribute. |
mobileId |
The temporal ID of the record. |
Id |
The ID of the record. |
errors |
Errors that occurred during the operation. |
hideOnDevice |
The attribute stores the true value if the Sync Recovery was applied for the record and the record was hidden on the device. |