function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
praveen kumar 110praveen kumar 110 

I am unable to execute the below code, could you please any one help on this.

 ReadResult result = metadataConnection.readMetadata('CustomField', new String[]{'Account.TYPE'});
    for( Metadata data : result.getRecords() )
    {
        CustomObjectTranslation objectTranslation = (CustomObjectTranslation)data;
        for( CustomFieldTranslation fieldTranslation : objectTranslation.getFields() )
        {
            if( fieldTranslation.getPicklistValues().length > 0 )
            {
                System.out.println( 'Field: ' + fieldTranslation.getName() );
                for( PicklistValueTranslation value : fieldTranslation.getPicklistValues() )
                    System.out.println( '   '+ value.getMasterLabel() + ' -> ' + value.getTranslation() );
            }
        }
    }

I got below error:
---------------------
Unexpected token 'result'.
Tej PalTej Pal
Hi Praveen,

Refer below url and check ReadResult class has getRecords() method.
http://grepcode.com/file/repo1.maven.org/maven2/com.force.api/force-metadata-api/34.0.0/com/sforce/soap/metadata/ReadResult.java?av=f

If this answers your question mark Best Answer it as solution and then hit Like!
praveen kumar 110praveen kumar 110
How do i execute the above code in salesforce, while executing i got error like this "Unexpected token 'result'.", so let any one tell me what are the prerequisites softwares are needed.