You need to sign in to do that
Don't have an account?
praveen 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'.
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'.
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!