-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
3Questions
-
2Replies
Update Picklist Values on Layout via Metadata API?
I have a custom object linked to Account. On the custom object I have a picklist with values that I update via the metadata API. The problem is my picklist values are not being displayed because they need to be associated with a record type on the custom object layout. I can query the layout using describeLayout(), but I have no idea how to update the layout for that field to allow the new picklist values to be shown. Does anyone know how to do this?
Thanks,
Derek
- D-Price
- January 28, 2013
- Like
- 0
- Continue reading or reply
How to Query CustomObject via Metadata API?
Is there a way to query a CustomObject, like Account, to get all it's current metadata settings? It seems like all the examples expect you to create a new CustomObject, set the full name to "Account" and then run update. I've seen no clear examples of how to query the Account metadata analoguous to how you can query for Account records using the EnterpriseConnection query() method.
Is there a way to do this?
Thanks,
Derek
- D-Price
- July 13, 2012
- Like
- 0
- Continue reading or reply
Update Custom Picklist on Account using API
I am trying to update (add a value to) a custom picklist that is on our Account. I'm getting confused by Enterprise route and the Metadata route.
This post seems close, but I don't want to rename a field just to add a new value:
Here's the code I'm working with using an Enterprise connection:
public void updatePicklistSample(EnterpriseConnection connection) { try { DescribeSObjectResult describeSObjectResult = connection.describeSObject("Account"); Field[] fields = describeSObjectResult.getFields(); // create a map of all fields for later lookup Map<String, Field> fieldMap = new HashMap<>(); for(Field field : fields) fieldMap.put(field.getName(), field); for(Field field : fields) { // check whether this is my picklist if(field.getName().equals("My_Custom_Picklist__c")) { ArrayList<PicklistEntry> pickListValuesArrayList = new ArrayList<>(); for(PicklistEntry picklistEntry : field.getPicklistValues()) pickListValuesArrayList.add(picklistEntry); final PicklistEntry entry = new PicklistEntry(); entry.setActive(true); entry.setDefaultValue(false); entry.setValue("9999"); entry.setLabel("9999"); pickListValuesArrayList.add(entry); final PicklistEntry[] plv = pickListValuesArrayList.toArray(new PicklistEntry[pickListValuesArrayList.size()]); field.setPicklistValues(plv); } } // What to update here? connection.update(????); } catch(ConnectionException ce) { fail("Connection failed: " + ce); } }
I'm just not sure what SObject I need to update.
I've also seen this sample that creates a new picklist, but I just want to update a custom field on Account:
Does anyone have a clear example on how to do this? Any suggestions?
Thanks,
Derek
- D-Price
- July 10, 2012
- Like
- 0
- Continue reading or reply
How to Query CustomObject via Metadata API?
Is there a way to query a CustomObject, like Account, to get all it's current metadata settings? It seems like all the examples expect you to create a new CustomObject, set the full name to "Account" and then run update. I've seen no clear examples of how to query the Account metadata analoguous to how you can query for Account records using the EnterpriseConnection query() method.
Is there a way to do this?
Thanks,
Derek
- D-Price
- July 13, 2012
- Like
- 0
- Continue reading or reply