Fieldname dialog in args

How can i pass the fieldname of dialog in args on javascript?

var d = new frappe.ui.Dialog({
			'fields': [
        			{'fieldname': 'motivo_alteracao_vencimento', 'label': 'Motivo da Alteração', 'fieldtype': 'Small Text', 'reqd': 1},
				{'fieldname': 'data_vencimento', 'label': 'Nova Data de Vencimento', 'fieldtype': 'Date', 'reqd': 1}
    			],

I wanna get the values of fieldname: ‘motivo_alteracao_vencimento’ and set to my frm field, but i don’t know pass this field of dialog in args like:

args:{
          my_frm_field: dialog.motivo_anteracao_vencimento
}

Got it!

var values = dialog.get_values()
args:{ 
         values: values.fieldname_of_dialog
}

I’m trying set the values now:

JS:

//Button "alterar data de vencimento da parcela"
	frm.add_custom_button(__("Alterar Vencimento"), function(){
		//When clicked
		var dialog = new frappe.ui.Dialog({
			'fields': [
        			{'fieldname': 'motivo_alteracao_vencimento', 'label': 'Motivo da Alteração', 'fieldtype': 'Small Text', 'reqd': 1},
				{'fieldname': 'data_vencimento', 'label': 'Nova Data de Vencimento', 'fieldtype': 'Date', 'reqd': 1}
    			]
		});
		dialog.set_primary_action(__("Salvar"), function() {
			var btn = this;
			var values = dialog.get_values();
			frappe.call({
				method: "erpnext.accounts.utils.alterar_vencimento_titulo",
				args:{
					motivo_alteracao_vencimento: values.motivo_alteracao_vencimento,
					novo_vencimento: values.data_vencimento,
					documento: frm.doc.name,
				},
				callback:function(r){
					frappe.show_alert(r.message);
				}
			});
		console.log(frm.doc.name)
		});
		dialog.show();
	});

PY:

@frappe.whitelist()
def alterar_vencimento_titulo(documento, motivo_alteracao_vencimento, novo_vencimento):
        titulos = frappe.get_doc("Titulos", documento)
        titulos.motivo_alteracao_vencimento = motivo_alteracao_vencimento
        titulos.data_vencimento = novo_vencimento
        return None

When i click on the button:
Error: Uncaught TypeError: Cannot read property ‘indicator’ of undefined

Code seems okay. Are you still facing the same issue?

Yes…

console.log(frm.doc):

Solved!
I do not understand how, cause i don’t changed nothing…