2

There is a method called getScope() in ReportMetadata Class. Can someone please shed some light on what 'Scope' actually means? Where/how is it specified? What are the possible (API/system-digestible) values?

Per documentation:

Returns the API name for the scope defined for the report. Scope values depend on the report type.

Background:

I am trying to update report metadata via REST API. Upon GET, I see that the metadata returns something called "scope":"organization" in JSON. After making a couple column API name changes, I POST the request back to save changes to server. Sadly, I get an error response saying "scope":"organization" is invalid. Because I couldn't find much documentation around it, I did some random GETs on other reports and noticed that some returned "scope":"team" instead. I then tried updating a report that has "scope":"organization" with "scope":"team" and it worked without complaining. Now I am worried if that is OK to do? I am hoping this doesn't cause more grief than good. I don't see any visual differences in the report after the change, though. Thoughts?

UPDATE 1:

I just figured that 'Scope' relates to a report being public or private. More info here.

Supported Query Scopes

Use these scopes to help specify the data your SOQL query returns.

allPrivate Records saved in all users’ private folders. Requires the user permission "Manage All Private Reports and Dashboards" and Enhanced Analytics Folder Sharing. If your organziation was created after the Summer ’13 release, you already have Enhanced Analytics Folder Sharing. Available in API version 36.0 and later.

created Records created by the user running the query.

everything All records except records saved in other users’ private folders.

mine Records saved in the private folder of the user running the query.

organizationOwned Records saved in Unfiled Public Reports. In Lightning Experience, the Unfiled Public Reports folder is called Public Reports.

But now, how do I know the actual value to pass to the REST API endpoint? Like I mentioned above, the values from what I gathered based on the reports in our org so far are organization, team, useronly (definitely not an exhaustive list).

UPDATE 2:

Here is more on Scope. I now see 'Team' in there, but no 'Organization'...?! What is the difference between this and Supported Query Scopes I linked to above?

  • The specific words (e.g. organization vs organizationOwned) might be API version dependent. What happens if you try versions 45.0 and probably 37.0 or 32.0? Any difference? – sfdcfox Feb 15 at 18:06
  • Wow... the same action on the same report in different versions returned different error messages: v39.0 = "organization is not a valid scope." v45.0 = "The column BucketField_62445055 is not a valid column., sourceColumnName could not be found. It is either not a valid column api name or you do not have access to this column., organization is not a valid scope., For the filter 6: Specify a valid filterable column because BucketField_62445055 is invalid." v37.0 = "The clone request must contain a valid cloneId parameter." v32.0 = "HTTP Method 'POST' not allowed. Allowed are GET" – Lightning Evangelist Feb 15 at 19:33

Your Answer

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

Browse other questions tagged or ask your own question.