Skip to main content

Hi All,


I am working in a Salesforce Org that uses Shield and has the Name field encrypted. The issue I am having is that one of the fields I am trying to reference in skuid is a lookup field. Despite the fact that I am telling the lookup to order by the createddate, it’s ordering the search list by name and as a result is giving em an error.


"SELECT Name,Id FROM Account ORDER BY Name,Id LIMIT 51


Error:field ‘Name’ can not be sorted in a query call

"


I am certain the issue is that the name field on the account object is encrypted, so I am unsure why this is happening if I am specifying a different field to order by.

Hey @rmilly, welcome to the Skuid Community :skuid_giving_thumbs_up:


Sounds like since the Name field is encrypted, the lookup field can’t access it. Here’s what you can do:


  1. Create another model on your page called Accounts. Order it by Created Date and include the ID and Name fields.

  2. In your lookup field properties, for the Search Option source, choose Model, and choose your Accounts model.

  3. Now you just need to make sure your accounts model (a) contains any fields you want to use in the display and search template and (b) has no limits so it will bring in all the accounts in your org (with any relevant conditions applied). If you have a lot of accounts in the org, it might make sense to load model in an action sequence that runs at page load so it doesn’t slow down initial page load.

This way you’re loading the account names into the page so they’re accessible to the lookup.

Cheers!


@Anna_Wiersema Thanks so much! this was exactly what I needed! I had to modify a few other things as the search functionality wasn’t working perfectly (since you cant search by an encrypted field), but I figured out a way to get around that. Really appreciate your help, I was about to pull out what little hair i had left.


Yay - glad you were able to figure it out and still have some hair left! 🥳


Do share here if there’s any other information that it’s good to know for others who are trying to set this up.


Reply