An error occurred while attempting to perform the SOQL query

Hi Skuid Team,


we are getting this below error while loading skuid page which has a skuid table in it,
An error occurred while attempting to perform the following SOQL query: SELECT id,name,createddate FROM Account ORDER BY , Some_Custom_Field_c DESC NULLS LAST LIMIT 51 Error:unexpected token: ‘,’

as per the account model, we have added “CreatedDate DESC” into this model property “Fields to order records by”.
and this Some_Custom_Field__c, we have made this field sort through table column header.  I have put model row limit to 50 but it is showing 51 in the query

this soql query should run like below but it is throwing  error,

SELECT id,name,createddate FROM Account ORDER BY CreatedDate, Some_Custom_Field_c DESC NULLS LAST LIMIT 50

note: this error is coming for only one user and all other user with same profile are woking fine.

Hi Akanksha. This may be happening if the user doesn’t have access to the fields you’re using in the ORDER BY section, or if the field names have a typo.
What happens when you switch the order of the fields? Like this: SomeCustomField__c, CreatedDate DESC?

And what happens if you just use SomeCustomField__c and leave out the CreatedDate field from the order-by section?

Hi Mark,

thans for your reply,
if this is related to access issue then below error will display and this issue is coming only for one user related to particular profile. if this is related to access then all user should affect not only one user.

1. A Skuid Model, ‘ModelRecords’, requested a Field with relationship name ‘SomeCustomField__c’, on the Account Object, but Skuid could not find a valid Field accessible through this relationship name. Please check that this Field actually exists on this Object (or on any related Objects). If it exists, then ensure that the user has permission to access it. If it does not exist, remove it from this Model.

we are not able to replicate this scenario in our sandbox and in prod we cant make any changes.

Which version of the Skuid package is in your production org, and which is in your sandbox? 

The error you shared would actually only show if the user had the Skuid Page Builder permission set. If they just have the Skuid Page Viewer permission set, then field access errors should not show. (This is by design.) So, it’s still possible that there is a permission or field level security setting missing for this user. Perhaps it’s only missing in production, and is present in the sandbox?

Hi Mark,

skuid version number is 11.2.9 in both production and sandbox.
Prod user has only “Skuid Page Viewer” permission set.
if there is a permission or field level security setting missing for this user. then other user should also face this issue but all other user are not having this error.


In that case, it sounds like there may be something about this page that is causing the issue.  

If that’s true, here are a few troubleshooting suggestions to try, using a clone of the page:

  • Set up a new simple page that queries the same object, with the same model setup. If the same issue happens for this user on the new page, then it's likely that the problem is related to a Salesforce setting or permission. If not, then continue on.
  • Remove all custom Javascript from the clone and see if the issue persists for this user. If the SOQL query string looks correct after removing the JS, then try removing one JS resource at a time to see which one may be causing trouble. 
  • If removing all Javascript doesn't resolve the SOQL query issue, then restore it. Use the XML editor to 'brute-force' your investigation. Comment out sections of the XML and reload the page as the affected user, to check if the SOQL query string looks correct or not. Try commenting out any action sequences (towards the end of the XML), or other models besides the affected model.