ERPNext Conference 2019* ERPNext.com Blog

Table Multiselect - TypeError: undefined is not an object (evaluating 'e.fields')


#1

I have created a custom doctype which is linked inside the Event doctype as Table Multiselect

Unfortunately, I cannot open the table row to edit the table multiselect field and in the browser console this error appears:

TypeError: undefined is not an object (evaluating 'e.fields')

get_link_field — table_multiselect.js:137
set_formatted_input — table_multiselect.js:110
(anonymous function) — class.js:53
set_input — data.js:76
n — base_input.js:69
refresh_input — base_input.js:88
refresh — base_control.js:85
attach_doc_and_docfields — layout.js:325
refresh — layout.js:223
render — grid_row_form.js:24
show_form — grid_row.js:524
toggle_view — grid_row.js:510
(anonymous function) — grid_row.js:231
dispatch — jquery.min.js:3:7543
handle — jquery.min.js:3:5626
http://URL RETRACTED/assets/js/awesomplete.min.js.map

Any help will be very much appreciated !


#2

Any idea anyone ? it’s a bit important … haha


#3

I’ve tried in many ways and followed the ERPNext tutorial for this field … nothing works, issue is the same.

I’ve done bench build and even upgraded erpnext … issue is the same.

Any idea what’s up ? I’m on a macOS with Safari browser.

UPDATE: Confirming it’s not working on Google Chrome neither… here’s what shows up in google chrome console:

Uncaught TypeError: Cannot read property 'fields' of undefined
    at o.get_link_field (table_multiselect.js:137)
    at o.set_formatted_input (table_multiselect.js:110)
    at o.set_formatted_input (class.js:53)
    at o.set_input (data.js:76)
    at n (base_input.js:69)
    at o.refresh_input (base_input.js:88)
    at o.refresh (base_control.js:85)
    at init.attach_doc_and_docfields (layout.js:325)
    at init.refresh (layout.js:223)
    at GridRowForm.render (grid_row_form.js:24)

#4

If I understand correctly, you have a table in a table in a table? You can’t do that and that’s why you’re getting this error.
Nested table aren’t supported yet.


#5

Hmmm … that’s not exactly what I wanted to achieve.

I have doctype “Dive guide” as a Table Multiselect field inside the doctype “Itinerary” - the doctype “Itinerary” is set as a table inside the Event doctype. This is the exact formula…


#6

To better understand, inside the table in Event doctype, the “Add row” button doesn’t work neither… hence the error in the console.


#7

Correction for the scenario:

Doctype 1 - Dive guide name
Doctype 2 - Dive guide ( child doctype )
Doctype 3 - Itinerary

“Dive guide name” is put in “Dive guide” as a link field. “Dive guide” is put in “Itinerary” as Table Multiselect. “Itinerary” is put in Event doctype as table.

At some times, Editing the itinerary table in the Event doctype works but after saving the event and refreshing the page, the same errors in the browser console appear.


#8

Guys, I must insist on this subject because it is a very important feature for us.

Any input will be very much appreciated … is this format of doctypes impossible or is it a bug ?


#9

What did you put in the “Options” of the Multiselect?


#10

Hey Nahuel, thank you for the reply.

The name of the “Dive guide” doctype because that’s the link I need.


#11

Is it correctly spelled (the name of the “Dive guide” doctype)? The error is caused because meta is undefined in this code:

const meta = frappe.get_meta(this.df.options);
this._link_field = meta.fields.find(df => df.fieldtype === 'Link');

You should try the next solutions:
A) Put a hidden link field to the “Dive guide” doctype in your doctype
And, if that does not work,
B) Put a link field in the “Dive guide” doctype to the multiselect doctype (the one that has the multiselect)

I don’t know how the multiselect works and never saw it in use, but, from the code, i can tell that the error is there because your “Dive guide” doctype is not in the locals from frappe, i think that the A solution should put it there.


#12

i have also same issue in child table it shows as “undefined field”


#13

Thank you so much for taking the time to look into this… it means a lot.

For the solution, the “Dive guide” doctype has at this moment only one Link field point towards “Dive guide name”

I will try to add another hidden link as you said … trying it out both A and B options.

I can imagine the Table Multiselect is a new feature and it can have a bug the same as I discovered the one in Auto Repeat a few weeks ago… but it’s such an important feature haha


#14

@Nahuel_Nso sorry to inform that your A and B solutions, sadly do not work.

The error is the same in the browser console.


#15

To make things even more clear, here are the screenshots of the doctypes:

Doctype 1 = Dive guide name

Doctype 2 = Dive guide

Doctype 3 = Itinerary

Eventually the Itinerary doctype is added in the Event doctype like this:

NOTE: The Event doctype is edited using Customise option.


#16

Can anyone help to take a look at this before I must pay someone to fix this bug ? It’s holding us back from other developments.

Pretty please :slight_smile:


#17

Can’t let this get buried, it’s too important.

Help please :slight_smile:


#18

Link to error report https://github.com/frappe/erpnext/issues/19040


#19

I am still unable to use the Table Multiselect field …

Anyone has any idea please ? :slight_smile:


Make a Multi Select field in child Table
#20

The bug still blocks us from using the table multiselect field.

We’ve hired a developer experienced with erpnext / frappe - getting close but still not fixed yet.