HD Form Script Not Working
Script
function setupForm({
doc,
updateField,
call,
router,
$dialog,
createToast,
}) {
const actions = [
{
group: "Actions",
hideLabel: true,
items: [
{
label: "Open FC Info",
onClick: () => {
// Call API to get custom information
call("show_custom_info", {
ticket: doc.name,
// Include relevant fields for fetching data
}).then((data) => {
if (data.name) {
$dialog({
title: data?.title,
message: data?.message,
html: data?.html, // this field can be in HTML format
actions: [
{
label: "Open in FC",
variant: "solid",
onClick(close) {
let URL = `http://helpdesk:8010/app/hd-ticket/${doc?.name}`;
window.open(URL, "_blank");
},
},
// add more actions
],
});
}
});
},
},
{
label: "Close this ticket",
onClick: () => {
$dialog({
title: "Close this ticket?",
message: "Are you sure you want to mark this close this ticket?",
actions: [
{
label: "Close",
theme: "red",
variant: "solid",
onClick(close) {
updateField("status", "Closed", () => {
createToast({
title: "Ticket has been closed",
icon: "alert-circle",
});
close();
});
},
},
{
label: "Cancel",
variant: "outline",
onClick(close) {
close();
},
},
],
});
},
},
],
},
];
if (doc.status !== "Closed") {
actions.push({
label: "Close the ticket",
onClick: () => {
$dialog({
title: `Close ticket: ${doc.name}`,
message: "Are you sure you want to close this ticket?",
actions: [
{
label: "Close",
theme: "red",
variant: "solid",
onClick(close) {
updateField("status", "Closed", () => {});
close();
},
},
{
label: "Cancel",
variant: "outline",
onClick(close) {
close();
},
},
],
});
},
});
}
return {
actions,
};
}
Issue:
Frappe Cloud
Frappe Framework Version
frappe: 16.31.0 (HEAD)
Installed Apps
ERPNext
erpnext: 16.32.3 (HEAD)
Telephony
telephony: 0.0.1 (HEAD)
Helpdesk
helpdesk: 1.29.0 (HEAD)

