Showing results for 
Search instead for 
Do you mean 
Community Home Request Access Read Blogs Share Your Ideas Search Community View My Settings
Reply
New Member
Posts: 3
Registered: ‎10-21-2011

SDATA Picklist

I am trying to retrieve a list of picklist items using the SDATA REST API. Have tried using the format http://10.0.0.66:3333/sdata/slx/system/-/pickLists('kSYST0000386')?format=xml to bring back a list of cities but it just returns 

 

<sdataSmiley Tongueayload>
<slxSmiley TongueickList sdata:key="kSYST0000312" sdata:uri="http://10.0.0.66:3333/sdata/slx/system/-/pickLists('kSYST0000312')" sdata:lookup="http://10.0.0.66:3333/sdata/slx/system/-/pickLists">
<slx:name>Opportunity Product Status</slx:name>
<slx:allowMultiples>false</slx:allowMultiples>
<slx:valueMustExist>false</slx:valueMustExist>
<slx:required>false</slx:required>
<slx:alphaSorted>false</slx:alphaSorted>
<slx:noneEditable>false</slx:noneEditable>
<slx:createDate>2009-10-06T00:00:38+01:00</slx:createDate>
<slx:createUser xsi:nil="true" />
<slx:modifyDate>2009-10-06T00:00:38+01:00</slx:modifyDate>
<slx:modifyUser xsi:nil="true" />
<slx:items />
</slxSmiley TongueickList>
</sdataSmiley Tongueayload>

 

with no data. Has anybody managed to do this?

New Member
Posts: 3
Registered: ‎10-21-2011

Re: SDATA Picklist

Wrong payload it was:

 

<sdataSmiley Tongueayload>
<slxSmiley TongueickList sdata:key="kSYST0000386" sdata:uri="http://10.0.0.66:3333/sdata/slx/system/-/pickLists('kSYST0000386')" sdata:lookup="http://10.0.0.66:3333/sdata/slx/system/-/pickLists">
<slx:name>City</slx:name>
<slx:allowMultiples>false</slx:allowMultiples>
<slx:valueMustExist>false</slx:valueMustExist>
<slx:required>false</slx:required>
<slx:alphaSorted>true</slx:alphaSorted>
<slx:noneEditable>false</slx:noneEditable>
<slx:createDate>2009-10-06T00:00:38+01:00</slx:createDate>
<slx:createUser xsi:nil="true" />
<slx:modifyDate>2009-10-06T00:00:38+01:00</slx:modifyDate>
<slx:modifyUser xsi:nil="true" />
<slx:items />
</slxSmiley TongueickList>
</sdataSmiley Tongueayload>

Bronze Super Contributor
Posts: 129
Registered: ‎06-09-2009

Re: SDATA Picklist

You are looking for the items collection.

 

Try the following:

 

http://10.0.0.66:3333/sdata/slx/system/-/pickLists('kSYST0000386')/items?format=xml 

 

Notice that I appended "/items" to the URL to retreive the items collection.

Raul A. Chavez
http://raul.chavez.com
http://www.crmbi.com
Bronze Super Contributor
Posts: 129
Registered: ‎06-09-2009

Re: SDATA Picklist

To clarify:

 

This URL only brings the Picklist Items

http://10.0.0.66:3333/sdata/slx/system/-/pickLists('kSYST0000386')/items?format=xml

 

This URL brings down the Picklist and its items:

http://crmbisvr08:3333/sdata/slx/system/-/pickLists('k6UJ9A0003DN')?include=$children&format=xml

Raul A. Chavez
http://raul.chavez.com
http://www.crmbi.com
Highlighted
Bronze Super Contributor
Posts: 204
Registered: ‎03-10-2009

Re: SDATA Picklist

Or you could do this in .Net Smiley Happy

 

private void LoadPickList(string pklName, ComboBox cboName)
        {
            //Create the actually SData call
            SDataService service = new SDataService(_url + "/sdata/slx/system/-/", _user, _password);
            SDataResourceCollectionRequest sdataCollection = new SDataResourceCollectionRequest(service)
            {
                ResourceKind = "pickLists",
                QueryValues = {
                        {"where", "name eq '" + pklName + "'"},
                        {"include", "items"}
                    },
            };

            AtomFeed feed = sdataCollection.Read();

            DataTable table = new DataTable();

            table.Columns.Add("itemId");

            table.Columns.Add("itemText");

            foreach (AtomEntry tempEntry in feed.Entries)
            {
                SDataPayload pickList = (SDataPayload)tempEntry.GetSDataPayload();

                SDataPayloadCollection pickListItems = (SDataPayloadCollection)pickList.Values["items"];

                foreach (SDataPayload p in pickListItems)
                {
                    DataRow dr = table.NewRow();

                    dr["itemId"] = p.Key;

                    dr["itemText"] = p.Values["text"];

                    table.Rows.Add(dr);
                }
            }

            cboName.DataSource = table;

            cboName.DisplayMember = "itemText";

            cboName.ValueMember = "itemId";
        }

 


Sr. Sales Engineer
Gene Arnold