I have created two picklist values using metadata api and able to insert the values in the both the picklists, but I have to set the dependency between them, like one is controlling and other would be dependent. I don't want to do it manually.
Here is the code which is working fine to update the picklist values in the picklist fields. But having two issues.
- It is setting all the values inactive except the last one though I am setting isActive=TRUE for all the values.
Not found anything to set the controlling and dependent picklist values.
MetadataService.ValueSet picklistValueSet = new MetadataService.ValueSet(); MetadataService.ValueSetValuesDefinition valueDefinition = new MetadataService.ValueSetValuesDefinition(); List<MetadataService.CustomValue> values = new List<MetadataService.CustomValue>(); MetadataService.CustomValue customValue1 = new MetadataService.CustomValue(); customValue1.fullName = picklistValueFullname ; // inserting from csv customValue1.isActive = TRUE; customValue1.default_x = FALSE; customValue1.label = picklistValueLabel; // inserting it from csv values.add(customValue1); valueDefinition.value = values; valueDefinition.sorted = false; picklistValueSet.valueSetDefinition = valueDefinition; customField.valueSet = picklistValueSet; List<MetadataService.SaveResult> results = service.createMetadata(new MetadataService.Metadata[] { customField }); handleSaveResults(results[0]);