Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reading Picklist information from CustomField does not return picklist info #27

Open
afawcett opened this issue Jan 24, 2015 · 0 comments
Labels

Comments

@afawcett
Copy link
Owner

This is actually a bug in the Tooling API itself rather than the wrapper, but logging here to discuss. I did some research over on this StackExchange answer here.

To test this i updated the ToolingAPIDemo class and output the JSON returned, also tested (as per StackExchange answer) in Workbench, the info is just not present, yet you get the corresponding number of pick list items.... 👎

    public static void updatePicklist() {
        ToolingAPI toolingAPI = new ToolingAPI();

        // Query CustomObject object by DeveloperName (note no __c suffix required)
        List<ToolingAPI.CustomObject> customObjects = (List<ToolingAPI.CustomObject>) 
            toolingAPI.query('Select Id, DeveloperName, NamespacePrefix From CustomObject Where DeveloperName = \'Test\'').records;

        // Query CustomField object by Name (filtered by CustomObject Id)
        Id customObjectId = customObjects[0].Id;                            
        List<ToolingAPI.CustomField> customFields = (List<ToolingAPI.CustomField>) 
            toolingAPI.query('Select Id, DeveloperName, NamespacePrefix, TableEnumOrId, Metadata From CustomField Where TableEnumOrId = \'' + customObjectId + '\' And DeveloperName = \'YesNo\'').records;

        // Dump Picklist entries            
        for(ToolingAPI.PicklistEntry picklistEntry : customFields[0].metadata.picklist.pickListValues) {
            System.debug('Pick list label ' + picklistEntry.label);
        }

        // Next step would be to update pick list values and call the update Tooling API end point
        // ...
    }
afawcett pushed a commit that referenced this issue Jan 24, 2015
Does not currently work however, see here for
explanation.#27
@afawcett afawcett added the bug label Mar 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant