5

I'm doing some code generation based on the standard org sObject metadata.

As part of that process I'm using the DescribeSObjectResult.fields.picklistValues PicklistEntry records to determine which values can be assigned to a picklist field.

The following standard sObjects are returning duplicate picklist values for certain fields:

  • ActivityHistory.ActivityType Call/Email/Meeting/Other
  • LookedUpFromActivity.ActivityType Call/Email/Meeting/Other
  • MatchingRuleItem.Field Active/Address/Attachment_Link/City/Company/Complete/Contact/Country/Dear/Department/Description (times 12)/...
  • OpenActivity.ActivityType Call/Email/Meeting/Other
  • SetupEntityAccess.SetupEntityType ConnectedApplication

These aren't dependent picklists. The validFor field is null.

This affects both the REST and SOAP API metadata equally.

In workbench sending a GET REST request to /services/data/v44.0/sobjects/SetupEntityAccess/describe returns: enter image description here

Or as raw JSON:

"picklistValues" : [ {
      "active" : true,
      "defaultValue" : false,
      "label" : null,
      "validFor" : null,
      "value" : "ApexClass"
    }, {
      "active" : true,
      "defaultValue" : false,
      "label" : null,
      "validFor" : null,
      "value" : "ApexPage"
    }, {
      "active" : true,
      "defaultValue" : false,
      "label" : null,
      "validFor" : null,
      "value" : "ConnectedApplication"
    }, {
      "active" : true,
      "defaultValue" : false,
      "label" : null,
      "validFor" : null,
      "value" : "ConnectedApplication"
    }, {
      "active" : true,
      "defaultValue" : false,
      "label" : null,
      "validFor" : null,
      "value" : "CustomPermission"
    }, {
      "active" : true,
      "defaultValue" : false,
      "label" : null,
      "validFor" : null,
      "value" : "ExternalDataSource"
    }, {
      "active" : true,
      "defaultValue" : false,
      "label" : null,
      "validFor" : null,
      "value" : "NamedCredential"
    }, {
      "active" : true,
      "defaultValue" : false,
      "label" : null,
      "validFor" : null,
      "value" : "TabSet"
    } ],

Note how ConnectedApplication appears in two identical records.

I've tested API versions in the range v35.0 through to v44.0 and found the same results.

Any ideas on what's causing the duplicates? Since the API values are identical between the records there isn't much I can do to distinguish between them when calling the APIs.

Since this seems like a platform bug I've also raised case #21297094

1

This is almost certainly a bug. In addition, it also affects Apex code. Here's an example:

Map<String, Integer> valueCounts = new Map<String, integer>();
for(PicklistEntry value: MatchingRuleItem.Field.getDescribe().getPicklistValues()) {
    String apiName = value.getValue();
    Integer counter = valueCounts.get(apiName);
    if(counter == null) {
        counter = 0;
    }
    counter++;
    valueCounts.put(apiName, counter);
}
for(String apiName: valueCounts.keyset()) {
    integer counter = valueCounts.get(apiName);
    if(counter > 1) {
        system.debug(apiName+': '+counter);
    }
}

18:56:23.1 (82036541)|USER_DEBUG|[14]|DEBUG|A: 2
18:56:23.1 (82078051)|USER_DEBUG|[14]|DEBUG|Account: 5
18:56:23.1 (82098771)|USER_DEBUG|[14]|DEBUG|Account_Status: 2
18:56:23.1 (82120591)|USER_DEBUG|[14]|DEBUG|AccountNumber: 2
18:56:23.1 (82142252)|USER_DEBUG|[14]|DEBUG|AccountSource: 2
18:56:23.1 (82163297)|USER_DEBUG|[14]|DEBUG|Acero_Company_Id: 2
18:56:23.1 (82182241)|USER_DEBUG|[14]|DEBUG|Acero_Customer_ID: 2
18:56:23.1 (82229674)|USER_DEBUG|[14]|DEBUG|Address: 3
18:56:23.1 (82360038)|USER_DEBUG|[14]|DEBUG|Attendee: 2
18:56:23.1 (82391380)|USER_DEBUG|[14]|DEBUG|Basement: 2
18:56:23.1 (82439362)|USER_DEBUG|[14]|DEBUG|BillingAddress: 2
18:56:23.1 (82460270)|USER_DEBUG|[14]|DEBUG|BillingCity: 2
18:56:23.1 (82479554)|USER_DEBUG|[14]|DEBUG|BillingCountry: 2
18:56:23.1 (82500001)|USER_DEBUG|[14]|DEBUG|BillingCountryCode: 2
18:56:23.1 (82520766)|USER_DEBUG|[14]|DEBUG|BillingPostalCode: 2
18:56:23.1 (82539965)|USER_DEBUG|[14]|DEBUG|BillingState: 2
18:56:23.1 (82560541)|USER_DEBUG|[14]|DEBUG|BillingStateCode: 2
18:56:23.1 (82579815)|USER_DEBUG|[14]|DEBUG|BillingStreet: 2
18:56:23.1 (82674129)|USER_DEBUG|[14]|DEBUG|City: 2
18:56:23.1 (82692989)|USER_DEBUG|[14]|DEBUG|Client: 2
18:56:23.1 (82714094)|USER_DEBUG|[14]|DEBUG|Closed_Won_Amount: 2
18:56:23.1 (82815892)|USER_DEBUG|[14]|DEBUG|Contact: 2
18:56:23.1 (82840698)|USER_DEBUG|[14]|DEBUG|ContactCount: 2
18:56:23.1 (82861616)|USER_DEBUG|[14]|DEBUG|ContactId: 2
18:56:23.1 (82889137)|USER_DEBUG|[14]|DEBUG|CountAttachment: 2
18:56:23.1 (82956914)|USER_DEBUG|[14]|DEBUG|Delivery_Time: 2
18:56:23.1 (82986845)|USER_DEBUG|[14]|DEBUG|Description: 2
18:56:23.1 (83051810)|USER_DEBUG|[14]|DEBUG|Direct_Dial: 2
18:56:23.1 (83081272)|USER_DEBUG|[14]|DEBUG|Domain: 2
18:56:23.1 (83147530)|USER_DEBUG|[14]|DEBUG|Email: 2
18:56:23.1 (83166856)|USER_DEBUG|[14]|DEBUG|Email_2: 2
18:56:23.1 (83205838)|USER_DEBUG|[14]|DEBUG|Exec_Type: 2
18:56:23.1 (83235539)|USER_DEBUG|[14]|DEBUG|External_Id: 3
18:56:23.1 (83256479)|USER_DEBUG|[14]|DEBUG|ExtId: 2
18:56:23.1 (83284191)|USER_DEBUG|[14]|DEBUG|Fax: 4
18:56:23.1 (83341611)|USER_DEBUG|[14]|DEBUG|Filtered_Contact: 2
18:56:23.1 (83371660)|USER_DEBUG|[14]|DEBUG|FirstName: 3
18:56:23.1 (83419692)|USER_DEBUG|[14]|DEBUG|Hours_Worked: 2
18:56:23.1 (83438853)|USER_DEBUG|[14]|DEBUG|Industry: 3
18:56:23.1 (83459683)|USER_DEBUG|[14]|DEBUG|InitialComments: 2
18:56:23.1 (83506566)|USER_DEBUG|[14]|DEBUG|Jigsaw: 3
18:56:23.1 (83527181)|USER_DEBUG|[14]|DEBUG|KaplanPW: 2
18:56:23.1 (83548232)|USER_DEBUG|[14]|DEBUG|KaplanUser: 2
18:56:23.1 (83567300)|USER_DEBUG|[14]|DEBUG|Killme: 2
18:56:23.1 (83606067)|USER_DEBUG|[14]|DEBUG|LastName: 3
18:56:23.1 (83636419)|USER_DEBUG|[14]|DEBUG|Lead: 5
18:56:23.1 (83657318)|USER_DEBUG|[14]|DEBUG|Lead_Source: 2
18:56:23.1 (83676321)|USER_DEBUG|[14]|DEBUG|LeadSource: 2
18:56:23.1 (83714859)|USER_DEBUG|[14]|DEBUG|Lookup_Rollup_Summary: 2
18:56:23.1 (83857311)|USER_DEBUG|[14]|DEBUG|MangaHighPW: 2
18:56:23.1 (83878597)|USER_DEBUG|[14]|DEBUG|MangaHighUser: 2
18:56:23.1 (83908539)|USER_DEBUG|[14]|DEBUG|Master: 3
18:56:23.1 (83928052)|USER_DEBUG|[14]|DEBUG|Media_Source: 3
18:56:23.1 (83949055)|USER_DEBUG|[14]|DEBUG|MiddleName: 3
18:56:23.1 (83968452)|USER_DEBUG|[14]|DEBUG|MobilePhone: 2
18:56:23.1 (83998473)|USER_DEBUG|[14]|DEBUG|Name: 50
18:56:23.1 (84018947)|USER_DEBUG|[14]|DEBUG|New_Picklist: 2
18:56:23.1 (84057603)|USER_DEBUG|[14]|DEBUG|Number_Of_Opportunities: 2
18:56:23.1 (84078384)|USER_DEBUG|[14]|DEBUG|Number_of_Opps: 2
18:56:23.1 (84097526)|USER_DEBUG|[14]|DEBUG|NumberOfEmployees: 3
18:56:23.1 (84211006)|USER_DEBUG|[14]|DEBUG|Organization: 3
18:56:23.1 (84380706)|USER_DEBUG|[14]|DEBUG|Ownership: 2
18:56:23.1 (84404424)|USER_DEBUG|[14]|DEBUG|Package: 2
18:56:23.1 (84463295)|USER_DEBUG|[14]|DEBUG|Parent: 5
18:56:23.1 (84484777)|USER_DEBUG|[14]|DEBUG|ParentId: 2
18:56:23.1 (84505631)|USER_DEBUG|[14]|DEBUG|ParentObject: 2
18:56:23.1 (84773845)|USER_DEBUG|[14]|DEBUG|Phone: 4
18:56:23.1 (84826703)|USER_DEBUG|[14]|DEBUG|Price_From: 2
18:56:23.1 (84893148)|USER_DEBUG|[14]|DEBUG|Project_Code: 3
18:56:23.1 (84914164)|USER_DEBUG|[14]|DEBUG|Project_Site: 3
18:56:23.1 (84970581)|USER_DEBUG|[14]|DEBUG|Rating: 3
18:56:23.1 (85091647)|USER_DEBUG|[14]|DEBUG|Rollup_Child_Amount: 2
18:56:23.1 (85138885)|USER_DEBUG|[14]|DEBUG|Salutation: 3
18:56:23.1 (85176971)|USER_DEBUG|[14]|DEBUG|ShippingAddress: 2
18:56:23.1 (85198073)|USER_DEBUG|[14]|DEBUG|ShippingCity: 2
18:56:23.1 (85218942)|USER_DEBUG|[14]|DEBUG|ShippingCountry: 2
18:56:23.1 (85237929)|USER_DEBUG|[14]|DEBUG|ShippingCountryCode: 2
18:56:23.1 (85258764)|USER_DEBUG|[14]|DEBUG|ShippingPostalCode: 2
18:56:23.1 (85279658)|USER_DEBUG|[14]|DEBUG|ShippingState: 2
18:56:23.1 (85298444)|USER_DEBUG|[14]|DEBUG|ShippingStateCode: 2
18:56:23.1 (85318962)|USER_DEBUG|[14]|DEBUG|ShippingStreet: 2
18:56:23.1 (85357229)|USER_DEBUG|[14]|DEBUG|Site: 2
18:56:23.1 (85396923)|USER_DEBUG|[14]|DEBUG|SSN: 4
18:56:23.1 (85445205)|USER_DEBUG|[14]|DEBUG|Status: 3
18:56:23.1 (85501316)|USER_DEBUG|[14]|DEBUG|Suffix: 3
18:56:23.1 (85550264)|USER_DEBUG|[14]|DEBUG|Task: 3
18:56:23.1 (85569390)|USER_DEBUG|[14]|DEBUG|Task_Counter: 2
18:56:23.1 (85599062)|USER_DEBUG|[14]|DEBUG|testc: 3
18:56:23.1 (85637244)|USER_DEBUG|[14]|DEBUG|Timezone: 2
18:56:23.1 (85656556)|USER_DEBUG|[14]|DEBUG|Title: 4
18:56:23.1 (85706121)|USER_DEBUG|[14]|DEBUG|Type: 3
18:56:23.1 (85724908)|USER_DEBUG|[14]|DEBUG|U: 2
18:56:23.1 (85774644)|USER_DEBUG|[14]|DEBUG|userid: 2
18:56:23.1 (85875082)|USER_DEBUG|[14]|DEBUG|Version_Number: 2
18:56:23.1 (85928573)|USER_DEBUG|[14]|DEBUG|Website: 4

As such, this may affect Lightning Components, Visualforce pages, external pages generated from describe calls, etc. You may want to report this as well.

Interestingly, the "values" for all picklist values render as null instead of the correct label. In other words, any code that tries to describe these picklists will just see lots of null values in their picklists.

  • Thanks. I've added the details for replicating it from Apex to the support case. It's been escalated to T3. – Daniel Ballinger Jan 15 at 22:29

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.