function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
David81David81 

How to LIMIT query when using a standardController?

So I've got this great little VF page that perfectly meets the needs of our users when embedded in the standard Account page layout. The problem is, it doesnt work for non-admin users.

 

It's basically just a data table generated from:

 

<apex:dataTable value="{!Account.ActivityHistories}" var="a" rows="5" columns="5" columnswidth="10%,10%,10%,10%,60%"  rules="rows" width="100%" bgcolor="#F3F3EC" cellpadding="3px" cellspacing="2px">

 

 

When the Account page is viewed by a non-admin user though, the page returns:

 

Content cannot be displayed: MALFORMED_QUERY: Implementation restriction: activity aggregate relationships only allow security evaluation for non-admin users when LIMIT is specified and at most 500

 Ok, seems pretty self explanatory, just need to limit the query. But how? I'm only asking for the 5 most recent. I'm really hoping I don't have to write an extension just for this.

 

Any thoughts?

 

David81David81

Well, I got it working with an extension, but it would be nice if I could do without it.

SteveBowerSteveBower

I wonder if applying the limit is something that VF would do if you were rendering it with a pageBlockTable instead of within a dataTable? (Just because VF "knows" metadata within pageBlockTable) I agree that It does seem like something that should work out of the box. 

 

Curious if you run the experiment...   Best, Steve.

David81David81

No go with the pageBlockTable either sadly.

SteveBowerSteveBower

Does anything change if you:

 

Setup -> Customize -> Accounts -> Account Owner Report and check the "Allow all users to run the Account Owner Report" box?

 

(For some reason your issue has really piqued my curiousity... :-)   )

 

-Steve

SteveBowerSteveBower

Btw,  I'm almost certain that setting above won't do a thing... I'm just curious. 

 

When you run as a non-admin do your users have "View all" permission for Accounts?

David81David81

Account Sharing is not private for us, so that option doesn't exist.

 

The user profile in question has "View All" for Accounts and Contacts.

 

I've got a case open with Dev Support, we'll see how that  goes.

Jonathan IJonathan I

Was there ever any resolution?

David81David81

Just went back to look at my case with support.

 

Answer was "you must use an extension".

 

Unfortunate, yes?

Jonathan IJonathan I

Nice... Thanks for taking the time to check!

 

I just found in this post ( http://boards.developerforce.com/t5/Visualforce-Development/Implementation-restriction/td-p/200927 ) that removing the "with sharing" from the class description does resolve the issue for my users.

David81David81

Yeah, that's still using an extension class though. If you just wanted to use a VF page with the standard controller, it seems you'd be SOL.