• KOD123
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies

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?

  • October 31, 2010
  • Like
  • 0