none
Project Server 2013: Filtering projects by custom field from JavaScript Client Object Model or REST RRS feed

  • Question

  • Hi,

    we want to retrieve some projects from Project Server, then update some custom fields and write the projects back to Project Server using JavaScript.
    Because we have thousands of projects in our system, a server side filter on a custom field has to be applied before delivering the data to the browser.

    I know that filtering projects using the .NET CSOM is possible by using LINQ, but I couldn't find any similiar functionality in the Client Side Object Model for JavaScript.

    Another approach I tried was using the REST API with it's $filter parameter, but had no luck with it, yet. I always get an error like "Field or property "Custom_ddf18a84c993e2118b3200155d8c6d35" does not exist.". I tried the following URLs:
    /_api/ProjectServer/Projects?$filter=Custom_ddf18a84c993e2118b3200155d8c6d35%20eq%20%27Test%27
    /_api/ProjectServer/Projects?$filter=IncludeCustomFields/Custom_ddf18a84c993e2118b3200155d8c6d35%20eq%20%27Test%27

    Realizing that in the REST response all "_" in the custom field names are replaced by "_x005f_" I also tried the variants with "Custom_x005f_ddf18a84c993e2118b3200155d8c6d35"... without success.

    Using a default property like "Name" instead works as expected.

    I can hardly believe that it is not possible to filter projects by a custom field, so can anybody give me a hint what I'm doing wrong here?

    Is there another way to achieve this using the JavaScript client side APIs?

    Thanks for your input.

    Regards,

    Gregor

    Thursday, May 15, 2014 8:39 PM

All replies

  • This can now be done using the following:

    /_api/ProjectData/Projects?$filter=CustomFieldName eq 'CFValue'

    Note: 'ProjectData' instead of 'ProjectServer', and the custom field is specified using it's name rather than it's internal name.

    Thursday, September 17, 2015 1:30 PM