• CP_PD
  • NEWBIE
  • 10 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 4
    Replies
I am updating a picklist value through API 37.0 using .net c#
It works fine, but if the user select another value in the picklist, the value I added is gone.

I can't find a property to save the value.

any suggestions ?
  • September 30, 2016
  • Like
  • 0
Some years ago, I created a Synkronization between Dynamics NAV and Salesforce via API version 24, and works fine :-)
Now I ned to call Salesforce API Version 37. I have downloaded sforce and metadata WSDL files, and everything is ok - except for one thing: Addiing a piclist value to a picklist.

API Version 24
In this version I read the picklist value one by one and created a new picklist. Finaly I added the piclist like:
 
// Update the existing picklist.
                        UpdateMetadata umd = new UpdateMetadata();
                        umd.currentName = tableName + "." + fieldName;
                        umd.metadata = picklistField;
                        MetadataService mds = new MetadataService();
                        mds.SessionHeaderValue = new metadata.SessionHeader();
                        mds.SessionHeaderValue.sessionId = sessionID;
                        mds.Url = metadataURL;
                        AsyncResult result = mds.update(new UpdateMetadata[] { umd })[0];

API Version 37
WSDL metadata no longer have the type UpdateMetadata, from where I added the picklist in API version 24. I can read elements of the picklist, but I cannot add the list.

I have "asked Google", if he could help me, but I got no response.
(for API Version 37)

I you have a piece of code adding a picklist though API 37, I would be greatful.
 
  • August 18, 2016
  • Like
  • 0

I don't know, if my problem is using/understanding the metadata api or adding a value to a picklist.

 

I'm using the same example (apparently like everybody else on this planet):

http://boards.developerforce.com/t5/NET-Development/Adding-a-new-value-to-a-picklist-field-90-there/td-p/108579

 

and when I reach:

 

while (!result.done) {
System.Threading.Thread.Sleep(result.secondsToWait * 1000);
result = checkStatus(new string[] { result.id })[0];
}

It loops infinitely (done will never be true).

 

Are there someone out there, who has another c# code example of adding a value to e picklist

(through metadata api)

  • April 30, 2012
  • Like
  • 0
I am updating a picklist value through API 37.0 using .net c#
It works fine, but if the user select another value in the picklist, the value I added is gone.

I can't find a property to save the value.

any suggestions ?
  • September 30, 2016
  • Like
  • 0
Some years ago, I created a Synkronization between Dynamics NAV and Salesforce via API version 24, and works fine :-)
Now I ned to call Salesforce API Version 37. I have downloaded sforce and metadata WSDL files, and everything is ok - except for one thing: Addiing a piclist value to a picklist.

API Version 24
In this version I read the picklist value one by one and created a new picklist. Finaly I added the piclist like:
 
// Update the existing picklist.
                        UpdateMetadata umd = new UpdateMetadata();
                        umd.currentName = tableName + "." + fieldName;
                        umd.metadata = picklistField;
                        MetadataService mds = new MetadataService();
                        mds.SessionHeaderValue = new metadata.SessionHeader();
                        mds.SessionHeaderValue.sessionId = sessionID;
                        mds.Url = metadataURL;
                        AsyncResult result = mds.update(new UpdateMetadata[] { umd })[0];

API Version 37
WSDL metadata no longer have the type UpdateMetadata, from where I added the picklist in API version 24. I can read elements of the picklist, but I cannot add the list.

I have "asked Google", if he could help me, but I got no response.
(for API Version 37)

I you have a piece of code adding a picklist though API 37, I would be greatful.
 
  • August 18, 2016
  • Like
  • 0