FIll Select Field (ERPNext v13)


I have the following script:

let load_prices = function(frm, cdt, cdn) {
var child = locals[cdt][cdn];{
method: ‘frappe.client.get_list’,
args: {
‘doctype’: ‘Item Price’,
‘filters’: {‘item_code’: child.item_code},
‘fields’: [‘currency’, ‘price_list_rate’],
callback: function(data) {
var prices = [];
var money = new Intl.NumberFormat(‘de-DE’, { style: ‘currency’, currency: ‘RUB’ });

  	(data.message || []).forEach(function(row) {
  			'value': row.price_list_rate, 
  			//'label': row.price_list_rate + " " + row.currency
  			'label': money.format(row.price_list_rate)
  	frappe.meta.get_docfield('Opportunity Item', 'prices', = prices;


I am getting data in prices (array(‘label’: label_text, ‘value’: value_text))

But I am unable to load this data into SelectField with name ‘prices’
(this is line no worked):
frappe.meta.get_docfield('Opportunity Item', 'prices', = prices;

This script worked in ERPNext12.

I used this is:
[Tutorial] set_df_property for child table fields?

Did you try the other way mentioned in the guide you linked (cur_frm.set_df_property)?

i am try

cur_frm.set_df_property('prices', 'options', [1,2,3]);

but that doesn’t work either

after this i am print (console.log()) field object and it has no property ‘options’

in console:
var test_field = frappe.meta.get_docfield('Opportunity Item', 'prices',

 // this object haven't options property

test_field.options = ['1', '2', '3']
// ok. im see array in options

but field price (DOM) empty

If you go to the “frappe-bench/apps/frappe/frappe/website/doctype/web_form/web_form.js” file you will find a function that updates the option in a select field inside a child table:

frm.fields_dict.web_form_fields.grid.update_docfield_property('fieldname', 'options', fields);

replace “fieldname” with the name of your field in the table
replace “fields” with option object (with value and label keys).

hope this helps