Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. //Create the valueSet for picklist type
  2. MetadataService.ValueSet picklistValueSet = new MetadataService.ValueSet();
  3.  
  4. //For each ValueSet, we have either ValueSetValuesDefinition or ValueSettings and some other attributes
  5. MetadataService.ValueSetValuesDefinition valueDefinition = new MetadataService.ValueSetValuesDefinition();
  6.  
  7. List<MetadataService.CustomValue> values = new List<MetadataService.CustomValue>();
  8. MetadataService.CustomValue customValue1 = new MetadataService.CustomValue();
  9. //Adding "Default" value as one picklist value in the newly created picklist
  10. customValue1.fullName = valFullName ;
  11. customValue1.description = '';
  12. customValue1.isActive =TRUE;
  13. customValue1.default_x = FALSE;
  14. customValue1.label = valLabel;
  15. values.add(customValue1);
  16.  
  17. //It will be list of CustomValue
  18. valueDefinition.value = values;
  19. valueDefinition.sorted = false;
  20.  
  21. //set the valueSetDefinition
  22. picklistValueSet.valueSetDefinition = valueDefinition;
  23.  
  24. //Set the valueSet for picklist type
  25. customField.valueSet = picklistValueSet;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement