You need to sign in to do that
Don't have an account?
Add picklist values through API
Hello,
I have a multi picklist in the Account object and the values should be taken from an object which is external to SF.
I want that once I add a new value to this table which is external it will update the multi picklist value through API.
I wrote the following code as a simple example:
MetadataService ms = new MetadataService();
ms.SessionHeaderValue = new com.salesforce.metadata.SessionHeader();
ms.SessionHeaderValue.sessionId = lr.sessionId;
ms.Url = lr.metadataServerUrl;
Picklist expenseStatus = new Picklist();
PicklistValue Test1 = new PicklistValue();
Test1.fullName = "Test1";
PicklistValue Test2 = new PicklistValue();
Test2.fullName = "Test2";
PicklistValue Test3 = new PicklistValue();
Test3.fullName = "Test3";
PicklistValue Test4 = new PicklistValue();
Test4.fullName = "Test4";
expenseStatus.picklistValues = new PicklistValue[] { Test1, Test2, Test3, Test4 };
CustomField expenseStatusField = new CustomField();
expenseStatusField.fullName = "Members__c.Application_Progress__c";
expenseStatusField.label = "Application Progress";
expenseStatusField.type = FieldType.Picklist;
expenseStatusField.picklist = expenseStatus;
Metadata[] mdata = new Metadata[1];
mdata[0] = expenseStatusField;
AsyncResult[] ars =
ms.create(mdata);
I get the following error:
Status: ApiSalesF.com.salesforce.metadata.StatusCode.ALL_OR_NONE_OPERATION_ROLLED_BACK
Status Code: ApiSalesF.com.salesforce.metadata.AsyncRequestState.InProgress
Any suggestion?
The ALL_OR_NONE_OPERATION_ROLLED_BACK error should only be thrown via the Enterprise or Partner APIs, not the Metadata API. Do you know if you happen to be accidentally setting the AllOrNoneHeader SOAP header for this Metadata operation? I tried reproducing it, but was unable to.
I am having same problem.Did you get a solution ?
is there any way to edit picklist value through metadat API .
I am current testing meta data API via SOAP ui and till now I am able to add picklist values .
but can not edit any perticuler picklist value
eg . object : lead
field : number__c
type : picklist
values : 1 , 2
any methode i can edit 1 to 11 ??