Hi,
I have created a custom page and have a button for creating job card. But its not redirecting to a form, i am not sure how to redirect to a form, kindly help.
frappe.pages[‘test’].on_page_load = function(wrapper) {
var page = frappe.ui.make_app_page({
parent: wrapper,
title: ‘Job Card’,
single_column: true
});
page.set_primary_action(“Create Job Card”, function(){
var d = new frappe.ui.Dialog({
title: (‘Create Job Card’),
‘fields’: [
{‘fieldname’: ‘work_order’, ‘fieldtype’: ‘Link’, ‘options’: ‘Work Order’,‘label’:(‘Work Order Id’)}
],
primary_action_label: __(‘Create’),
primary_action: function(d) {
return frappe.call({
page:“test”,
method: “sample.sample.job_card.create_job_card”,
args: {
work_order_id : d.work_order
}
freeze: true,
callback: function(r){
if(!r.exc) {
var doc = frappe.model.sync(r.message);
frappe.set_route(“Form”, r.message.doctype, r.message.name);
}
}
});
d.hide();
show_alert(d.get_values());
}
});
d.show();
});
}
Thanks in advance!