• Janusz Gorycki 7
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
Hi,

I am trying to retrieve Task and Event objects using listview filters retrieved from REST endpoint /services/data/v37.0/sobjects/Task/listviews​
This works for most filters. However, if I encounter filter like "Todays Tasks", where the query contains the IsTask clause, I am getting this error:
FROM Task USING SCOPE mine WHERE IsTask = true AND IsClosed = false ^ ERROR at Row:1:Column:110 No such column 'IsTask' on entity 'Task'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.
The endpoint I am using for this is /services/data/v37.0/sobjects/Task/listviews/<filterId>/results
Now, I suspect that IsTask is a filed in Activity, which is a parent of Task and somehow the REST endpoint is incorrectly running the SOQL query when I invoke it. I am however unable to retrieve the actual SOQL that the filter is trying to perform, as running the "describe" REST endpoint (/services/data/v37.0/sobjects/Task/listviews/<filterId>/describe) results in this error:
sObject type 'Activity' is not supported in describeSoqlListViews.
Does anybody know how to retrieve the list of activities using REST properly? Is there some endpoint that does the kosher thing?

Janusz
Hi all,

I am trying to add custom buttons to search layouts using metadata API. Here is the java code:
ReadResult result = connection.readMetadata("CustomObject", new String[]{objectName});
Metadata[] records = result.getRecords();
CustomObject customObject = (CustomObject) records[0];
SearchLayouts layouts = customObject.getSearchLayouts();
ArrayList<String> buttons = Lists.newArrayList(layouts.getListViewButtons());
buttons.add(BUTTON_NAME);
layouts.setListViewButtons(buttons.toArray(new String[buttons.size()]));
customObject.setSearchLayouts(layouts);
connection.updateMetadata(new Metadata[]{customObject});

BUTTON_NAME is the name of the WebLink which has been created previously.
This works, but only when I have never accessed any of the list views of the object for which I want to add the button (I have a fresh dev instance set up, so this is still possible). 

If the list view has ever been visited, the button does not show up (see screenshot).
User-added image
However, the button does show up in the setup for "Search Layouts" for the object in question - as if it has been added to the layout. Plus querying the custom object reports the button as present in the layout also. And when I click the "Save" button in on that page (without modifying anything), the button suddenly appears in the list view!
User-added image
It is as if salesforce is doing some additional work when I click "Save" in addition to what the metadata API does. Plus the same additional work is apparently performed when the list view is accessed for the first time.

This is not a browser caching issue (I have tried on may browsers simultaneously).
This has also previously been reported by at least two people on some forums:

http://salesforce.stackexchange.com/questions/59784/metadata-api-searchlayouts-not-showing-updates
https://github.com/financialforcedev/apex-mdapi/issues/55


Does anybody know what is going on? And how I could fix this?
Hi,

I am trying to retrieve Task and Event objects using listview filters retrieved from REST endpoint /services/data/v37.0/sobjects/Task/listviews​
This works for most filters. However, if I encounter filter like "Todays Tasks", where the query contains the IsTask clause, I am getting this error:
FROM Task USING SCOPE mine WHERE IsTask = true AND IsClosed = false ^ ERROR at Row:1:Column:110 No such column 'IsTask' on entity 'Task'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.
The endpoint I am using for this is /services/data/v37.0/sobjects/Task/listviews/<filterId>/results
Now, I suspect that IsTask is a filed in Activity, which is a parent of Task and somehow the REST endpoint is incorrectly running the SOQL query when I invoke it. I am however unable to retrieve the actual SOQL that the filter is trying to perform, as running the "describe" REST endpoint (/services/data/v37.0/sobjects/Task/listviews/<filterId>/describe) results in this error:
sObject type 'Activity' is not supported in describeSoqlListViews.
Does anybody know how to retrieve the list of activities using REST properly? Is there some endpoint that does the kosher thing?

Janusz