function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Dennis H PalmerDennis H Palmer 

Dependent Picklist - Cannot read property '<parent fieldlabel>' of undefined

Scenario:
- Dependent Picklist on a Custom Object.
- Parent Picklist has 4 values.
- Child Picklist has 10 values.
- Only one parent Picklist value has values in the child Picklist.
- Double click to inline edit either picklist: Javascript Error: "Cannot read property '<parent fieldlabel>' of undefined". (<parent fieldlabel> is the Label of the parent field)

This is supposed to bring up the dependent Picklist field editor popup where both fields are there in a little popup with a save button.

I've tried:
1. Making at least one child value appear for all parent values.
2. Enabling/Disabling each Critical Update.
3. Moving the fields on the Page Layout.
4. Click the Edit button to edit instead of inline edit.  This works!  But doesn't fix the inline edit issue.

JS Stacktrace:
Uncaught TypeError: Cannot read property 'Carrier' of undefined
    at picklistForInlineEditing.picklist.generate (picklist2.js:7)
    at picklistForInlineEditing.generate (picklist2.js:11)
    at picklistForInlineEditing.picklist.onLoad (picklist2.js:5)
    at DynamicEnumField.load (main.js:1673)
    at InlineEditData.openGroup (main.js:1095)
    at InlineEditData.openField (main.js:1092)
    at InlineEditData.dynamicDataLoaded (main.js:1107)
    at HTMLScriptElement.<anonymous> (main.js:1107)
    at HTMLScriptElement.e (main.js:479)
picklist.generate @ picklist2.js:7
picklistForInlineEditing.generate @ picklist2.js:11
picklist.onLoad @ picklist2.js:5
DynamicEnumField.load @ main.js:1673
InlineEditData.openGroup @ main.js:1095
InlineEditData.openField @ main.js:1092
InlineEditData.dynamicDataLoaded @ main.js:1107
(anonymous) @ main.js:1107
e @ main.js:479

No idea on this one.  Stumped!
Dennis H PalmerDennis H Palmer
It looks like it is not pulling the field mapping between parent and child when it retrieves the parent picklist.
 
var g = new Bitset(this.mapping[a]),...

"this" refers to an object representing the parent Picklist field:
picklistForInlineEditing
    attributes:" id="00Ng0000001x3RE""
    container:span
    controller_id:"00Ng0000001wuPx"
    firstRound:true
    id:"00Ng0000001x3RE"
    initialValue:Array[2]
    isValid:true
    labelEl:null
    loaded:true
    mapping:undefined
    nalabel:"**Not Applicable**"
    nonelabel:"--None--"
    nullable:true
    onGenerate:null
    values:Array[20]
    __proto__:picklist

It is saying this.mapping is undefined.
Dennis H PalmerDennis H Palmer
Also, when you double click a Picklist fied that is a part of a dependency, javascript generates both fields to be displayed.  The parent field gets generated successfully.  The error happens when generating the child field.  It tries to load the values based on the mapping within the child field.  But the mapping is undefined for some reason.

The Picklist fields are retrieved via a call like this:
InlineEditData.prototype.loadDynamicData = function() {
    if (!this.sentRequest) {
        this.sentRequest = !0;
        var a = this;
        Sfdc.Resource.addJavaScript(this.dynamicDataUrl, function() {
            a.dynamicDataLoaded()
        })
    }
}
The dynamic url it uses to load these fields is /servlet/servlet.picklist?e=...

Which returns:
window.pl = window.pl || {};
pl.vals_0Ntg00000004CjL=['name','value','name','value','name','value','name','value'];
pl.vals_0Ntg00000004Cbb=['name','value','name','value','name','value','name','value','name','value','name','value','name','value','name','value','name','value','name','value'];
pl.noneLabel="--None--";
pl.naLabel="\*\*Not Applicable\*\*";
pl.selectedLabel="Chosen";
pl.availableLabel="Available";
There is is no mapping in the second (child) field.  I wonder if this call is not bringing the dependency over...

 
Dennis H PalmerDennis H Palmer
In the url there is a &ile=0.  When the ile is changed to &ile=1, an extra line is entered:
pl.map_00Ng0000001x3RE={'value':'/8AA'};
I found it!

Steps:
1. Breakpoint at line 6 of loadDynamicData above.
2. Go to the Javascript Console and paste in the above map line.
3. Remove breakpoint.
4. Press play.
5. The inline edit window loads!
The cause of this issue:  When dynamically loading information about the Picklist fields, the url that is used has &ile=0 instead of ile=1.  Lets see why the ile is 0...


 
Dennis H PalmerDennis H Palmer
Something curious happened.  Going to this dynamic data url and then reloading a bunch of times, made the map value pop into the results.  No changing the url.  Just reloading a lot.  Perhaps this is a propagation issue?  Or timing issue?  The ilr value is inconsequential.

The url is in the loaded HTML document
new InlineEditData({
    "dynamicData": "/servlet/servlet.picklist?e=...",
    "_CONFIRMATIONTOKEN": "token",
    "fields": [{
        "picklistId": "<id>",
        "state": "EDIT",
        "fieldType": "DYNAMICENUM",
        "initialValue": ["name", "value"],
        "required": true,
        "fieldId": "<id>"
    }, {
        "controllerLabel": "CPQ Pricebook",
        "picklistId": "<id>",
        "controller": "<id>",
        "state": "EDIT",
        "fieldType": "DYNAMICENUM",
        "initialValue": ["name", "value"],
        "required": false,
        "fieldId": "<id>"
    }],
    "editable": true,
    "entityId": "<id>",
    "sysMod": "<id>"
});
I am unsure as to why the url does not include the map value at first.
 
Dennis H PalmerDennis H Palmer
I think this is a propagation or caching issue.  I had a colleague load the url and they recieved a response that included the map value.  Find your dynamic data url, load it and reload it until the map line pops in.  Then refresh your Salesforce page with your dependent Picklist fields in it.
Dennis H PalmerDennis H Palmer
This is a continuous problem.  It intermittently either has the map line or it doesn't.  Very not good.  Will open a case.
Ryan Marquardt 24Ryan Marquardt 24
Hi Dennis,

Were you ever able to find a workaround for this? I'm experiencing this issue on apex:inlineEditSupport for dependent fields too. Any update to a dependent picklist breaks all inline editing - breaking my page...
Dennis H PalmerDennis H Palmer
The only thing we were able to do is clear all cookies and it worked.  I haven't checked to see if this issue still exists.  I doubt it exists in lightening.