SAP Knowledge Base Article - Public

2226942 - Picklist fields in the API entities does not return external code instead returns Picklist Option

Symptom

This KBA explains the reason behind returning the PickList option by default instead of external code

Environment

Bizx

Reproducing the Issue

For reproducing the issue we have taken the SFAPI entity EmpPayCompRecurring and we have configured a custom field of picklist type.

The label of the field is "Pay Cycle" and the field label in entity is "custom_string3".

The external code for the pick list is configured and data is entered in the UI.

The query is triggered, and we can see that instead of external code the picklist option is being returned.

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
  <S:Header/>
      <S:Body>
           <query xmlns="urn:sfobject.sfapi.successfactors.com" xmlns:ns2="urn:fault.sfapi.successfactors.com">

              <queryString>SELECT                   payComponentCode,seq_number,start_date,user_id,created_by,created_on,currency_code,custom_date1,custom_double1,custom_string1,custom_string2,custom_string3,custom_string4,custom_string5,custom_string6,dataSnapshotDate,end_date,frequencyCode,frequencyName,last_modified_by,last_modified_on,notes,payComponentName,paycompvalue,person_id_external FROM EmpPayCompRecurring
              </queryString>
            <param>
               <name>maxRows</name>
               <value>200</value>
            </param>
         </query>
     </S:Body>
</S:Envelope>

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
      <S:Body>
          <queryResponse xmlns="urn:sfobject.sfapi.successfactors.com" xmlns:ns2="urn:fault.sfapi.successfactors.com">
                <result>
                   <sfobject>
                       <type>EmpPayCompRecurring</type>
                       <payComponentCode>ATRP</payComponentCode>
                       <seq_number>1</seq_number>
                       <start_date>2015-09-11</start_date>
                       <user_id>EC1002</user_id>
                       <created_by>AdminNTT1</created_by>
                       <created_on>2015-09-11T19:31:48.000+10:00</created_on>
                       <currency_code>MYR</currency_code>
                       <custom_date1 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
                       <custom_double1 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
                       <custom_string1>1</custom_string1>
                       <custom_string2>12</custom_string2>
                       <custom_string3>2114</custom_string3>
                       <custom_string4>2</custom_string4>
                       <custom_string5 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
                       <custom_string6 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
                       <dataSnapshotDate>2015-09-28</dataSnapshotDate>
                       <end_date>9999-12-31</end_date>
                       <frequencyCode>M1</frequencyCode>
                       <frequencyName>Monthly Worker</frequencyName>
                       <last_modified_by>AdminNTT1</last_modified_by>
                       <last_modified_on>2015-09-11T19:31:48.000+10:00</last_modified_on>
                       <notes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
                      <payComponentName>Car Allowance (Fixed)</payComponentName>
                      <paycompvalue>100</paycompvalue>
                      <person_id_external>EC1002</person_id_external>
                   </sfobject>

               </result>

           </queryResponse>
       </S:Body>
</S:Envelope>

We can see in the response that custom_string3 is returning option ID instead of the external Code

Cause

This is the by-design behavior.

For picklist field, in API, we will return option id instead of external code since option id is key for platform picklist.

But external code could be filled or null in the platform picklist solution.

So to make sure there is always a correct value for the picklist field returned,we return option id instead of external code.

 

Resolution

The resolution would be to use the Picklist API to query the external code related to the corresponsing picklist option ID.

Here is an example on how to obtain the picklist external code using Picklist option API:

Soap Request

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
     <S:Header/>
           <S:Body>
                 <query xmlns="urn:sfobject.sfapi.successfactors.com" xmlns:ns2="urn:fault.sfapi.successfactors.com">
                     <queryString>SELECT externalCode,picklistId,en_US,id,maxValue,minValue,optionValue,parentOptionId,sortOrder,status FROM PicklistOption WHERE picklistId = 'zecCycle'</queryString>
                          <param>
                            <name>maxRows</name>
                            <value>200</value>
                          </param>
                      </query>
            </S:Body>
</S:Envelope>

Soap Response

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
     <S:Body>
          <queryResponse xmlns="urn:sfobject.sfapi.successfactors.com" xmlns:ns2="urn:fault.sfapi.successfactors.com">
              <result>
                 <sfobject>
                     <id>PKOP-2112</id>
                     <type>PicklistOption</type>
                     <externalCode>1E</externalCode>
                     <picklistId>zecCycle</picklistId>
                     <en_US>Mid-Month Cycle</en_US>
                     <maxValue>-1</maxValue>
                     <minValue>-1</minValue>
                     <optionValue>-1</optionValue>
                     <parentOptionId xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
                     <sortOrder>1</sortOrder>
                     <status>ACTIVE</status>
                  </sfobject>
                  <sfobject>
                     <id>PKOP-2113</id>
                     <type>PicklistOption</type>
                     <externalCode>2E</externalCode>
                     <picklistId>zecCycle</picklistId>
                     <en_US>Bonus Cycle</en_US>
                     <maxValue>-1</maxValue>
                     <minValue>-1</minValue>
                     <optionValue>-1</optionValue>
                     <parentOptionId xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
                     <sortOrder>2</sortOrder>
                     <status>ACTIVE</status>
                  </sfobject>
                  <sfobject>
                     <id>PKOP-2114</id>
                     <type>PicklistOption</type>
                     <externalCode>ME</externalCode>
                     <picklistId>zecCycle</picklistId>
                     <en_US>Month End Cycle</en_US>
                     <maxValue>-1</maxValue>
                     <minValue>-1</minValue>
                     <optionValue>-1</optionValue>
                     <parentOptionId xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
                     <sortOrder>3</sortOrder>
                     <status>ACTIVE</status>
                   </sfobject>
                   <sfobject>
                      <id>PKOP-2115</id>
                      <type>PicklistOption</type>
                      <externalCode>MX</externalCode>
                      <picklistId>zecCycle</picklistId>
                      <en_US>Month End - Claims Cycle</en_US>
                      <maxValue>-1</maxValue>
                      <minValue>-1</minValue>
                      <optionValue>-1</optionValue>
                      <parentOptionId xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
                      <sortOrder>4</sortOrder>
                      <status>ACTIVE</status>
                   </sfobject>  
                      <numResults>5</numResults>
                          <hasMore>false</hasMore>
                          <querySessionId>601c3516-94f9-4dd4-af0c-d045a83a4a14</querySessionId>
              </result>
           </queryResponse>
       </S:Body>
</S:Envelope>

Keywords

KBA , picklist field not fetching externalcode , LOD-SF-INT-BOM , Standard SF to 3rd Party Boomi Content , LOD-SF-INT-EC , Employee Central SFAPI & OData Entities , Problem

Product

SAP SuccessFactors HXM Core all versions