+ Start a Discussion

metadata api GlobalValueSet : Edit (java)


Trying to change values in a global picklist value set but when reading the metadata the CustomValue object is not filled. We only get the Value itself (label and name) but the isActiven, color ,... fields are not set :

Result :

[ReadResult  records='{[1][GlobalValueSet [Metadata  fullName='Application'
 customValue='{[84][CustomValue [Metadata  fullName='A01'

=> This value is certainly active in salesforce.

If we change the CustomValue object to isActive = true, and execute an update to salesforce, this error message is given :

"CustomField not found."

This is the method that reads the metadata of a GlobalValueSet 
private GlobalValueSet readGlobalValueSet(String picklist) throws Exception {
		GlobalValueSet affectsVersions = new GlobalValueSet();

			MetadataConnection metadataConnection = sfmcon.getConnection();
			ReadResult readResult = metadataConnection.readMetadata("GlobalValueSet", new String[] {picklist});
			Metadata[] mdInfo = readResult.getRecords();
			if (mdInfo.length == 1) {
				affectsVersions = (GlobalValueSet) mdInfo[0];
			else {
				log.info("None or multiple components");		
		catch(ConnectionException e){
		return affectsVersions;
Probably doing something wrong here, don't think it is authorization related as the user has Modify everything rights.

with regards
Anybody ?