I am using this query to get a list of old reports in private folders and I am wondering if I can include public folders also. Here is the query:

SELECT Id,name,LastRunDate,owner.firstname,foldername,owner.email,owner.isactive FROM Report USING SCOPE allPrivate WHERE LastRunDate < LAST_N_DAYS:365

If I use "USING SCOPE everything" I get a list of report in public folders. I want to combine these into one report.

Can I use more than one scope like this? USING SCOPE everything AND allPrivate

  • 1
    At least syntactically that's not allowed. – Jayant Das Apr 3 '19 at 16:56
  • 1
    @JayantDas - you should put this as an answer – cropredy May 15 '19 at 20:06
  • @cropredy Done! :) – Jayant Das May 15 '19 at 20:26

As suggested by @cropredy, rolling up comments as an answer.

Looking at the SOQL Syntax, it doesn't seem you can join different filterScope values. The AND keyword can be only used when you are utilizing that in WHERE clause.

SELECT fieldList [subquery][...]
[TYPEOF typeOfField whenExpression[...] elseExpression END][...]
FROM objectType[,...] 
    [USING SCOPE filterScope]
[WHERE conditionExpression]

<<other clauses removed for readability>>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.