Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clicking the "Find Volunteers" tab in an org using deterministic encryption returns 'Name' can not be sorted in a query call #487

Open
jesslopez-sf opened this issue Apr 20, 2020 · 8 comments

Comments

@jesslopez-sf
Copy link

If a customer enables Deterministic Encryption on the Contact Name field, the Find Volunteers tab fails to load. Instead, it shows the following error:

'Name' can not be sorted in a query call

This fails in our SoqlListView Apex class, on line 49.

if (SortItemField == null) {
   SortItemField = pageController.strNameField;
   SortItemAsc = true;      
}

if (SortItemField != null) {
   strSoql += ' ORDER BY ' + SortItemField + (SortItemAsc ? ' ASC' : ' DESC');
}

strSoql += ' LIMIT 10000';
setCon = new ApexPages.StandardSetController(Database.getQueryLocator(strSoql));

More information about Deterministic Encryption can be found here:
Considerations for Using Deterministic Encryption

Key points:

  • Case-insensitive deterministic encryption supports compound fields.
  • Because deterministic encryption doesn’t maintain the sort order of encrypted data in the database, ORDER BY isn’t supported.

Steps to Repeat:

  • Spin up v4s scratch org and run dev_org flow
  • Create Permission Set with “Manage Encryption Keys” System Permission. Assign this Permission Set to your User.
  • Go to Setup → Key Management. Click the Generate Tenant Secret button.
  • Go to Setup —> Advanced Settings. Enable Deterministic Encryption.
  • Go to Setup → Key Management and expand the picklist " Choose Tenant Secret Type" and select "Data in Salesforce (Deterministic)" -> "Generate Tenant Secret“
  • Go to Setup → Encryption Policy -> "Encrypt Fields" -> select "edit" and then check off the box "Name" under "Contact" and set the picklist value to "Deterministic - Case Insensitive" → "Save"
  • Once you receive an email saying the encryption was successful:
  • Go to the Find Volunteers tab. Confirm error appears.
  • Disabling encryption on the Contact Name field removes the error on the Find Volunteers tab.

For good measure, I tried enabling Probabilistic encryption on Contact Name. It failed due to the following references:

Contact.Name:
Apex Class: VOL_Access_TEST, line 201, column 32: field 'LastName' can not be filtered in a query call
Apex Class: VOL_Access_TEST, line 217, column 32: field 'LastName' can not be filtered in a query call
Apex Class: VOL_CTRL_VolunteersReportHours_TEST, line 161, column 19: field 'Firstname' can not be filtered in a query call
Apex Class: VOL_CTRL_VolunteersReportHours_TEST, line 180, column 19: field 'Firstname' can not be filtered in a query call
Apex Class: VOL_CTRL_VolunteersSignup_TEST, line 93, column 19: field 'Firstname' can not be filtered in a query call
Apex Class: VOL_CTRL_VolunteersSignup_TEST, line 111, column 19: field 'Firstname' can not be filtered in a query call
Apex Class: VOL_CTRL_VolunteersSignup_TEST, line 128, column 19: field 'Firstname' can not be filtered in a query call
Apex Class: VOL_CTRL_VolunteersSignupFS_TEST, line 94, column 19: field 'Firstname' can not be filtered in a query call
Apex Class: VOL_CTRL_VolunteersSignupFS_TEST, line 113, column 19: field 'Firstname' can not be filtered in a query call
Apex Class: VOL_CTRL_VolunteersSignupFS_TEST, line 130, column 19: field 'Firstname' can not be filtered in a query call
Apex Class: VOL_SharedCode, line 314, column 33: field 'Lastname' can not be filtered in a query call
Apex Trigger: VOL_SharedCode, line 314, column 33: field 'Lastname' can not be filtered in a query call```
@jesslopez-sf
Copy link
Author

**lurch: add

@LurchTheButler
Copy link

Tracking W-040932

@jesslopez-sf
Copy link
Author

**lurch: detach W-040932

@jesslopez-sf
Copy link
Author

**lurch: detach

@LurchTheButler
Copy link

Detached W-040932

1 similar comment
@LurchTheButler
Copy link

Detached W-040932

@jesslopez-sf
Copy link
Author

**lurch: attach W-025295

@LurchTheButler
Copy link

Tracking W-025295

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants