Refresh current form

I need refresh form in the end of function, but it’s not working…
Tried:
cur_frm.refresh();
frm.refresh();

1 Like

Please your share your code

Code:

frappe.ui.form.on("Titulos", "refresh", function(frm) {
	//Botão alterar data de vencimento da parcela
	frm.add_custom_button(__("Alterar Vencimento"), function() {
		//Quando clicar faça
		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.show();
		dialog.set_primary_action(__("Salvar"), function() {
			var values = dialog.get_values();
			frappe.call({
				method: "financeiro.financeiro.doctype.titulos.titulos.alterar_vencimento_titulo",
				args:{
					motivo_alteracao_vencimento: values.motivo_alteracao_vencimento,
					novo_vencimento: values.data_vencimento,
					doc_nome: frm.doc.name,
				},
				callback: function(r){
					console.log(r)	
				}
			}); 
			dialog.hide()
                    //after hide, i need refresh the form
		});
	});
});

You probably want to refresh after the call to your function, as opposed to right after you make the server call. You probably want to include this in your callback function, not after dialog.hide().

use frm.reload_doc()

11 Likes

Worked, thank you @Ben_Cornwell_Mott