What I'm trying to do is add a button onto the Task Form. When the user clicks the button I'd like it to change the status of the task to completed. I cannot seem to figure it out. I can get the ID of the task but I cannot figure out anything else. I tried to just display an alert with the task title and it doesn't work.
I know I'm missing something really simple, but I've wasted most of the day and still and all I have to show for it is a button that doesn't do anything.
Thanks in advance
define(["N/ui/dialog", 'N/record', 'N/currentRecord', 'N/search'], function (dialog, context, currentRecord, search) {
var exports = {};
function pageInit() {
// TODO
}
function onButtonClick() {
try {
var rec = currentRecord.get();
if (rec != null) {
dialog.alert({
title: "Message",
message: "current record is not null"
});
};
var taskid = rec.getValue({fieldId: 'contact' });
}
catch (e) {
dialog.alert({
title: "Error",
message: e.message
});
}
dialog.alert({
title: "Hello",
message: taskid
});
}
exports.onButtonClick = onButtonClick;
exports.pageInit = pageInit;
return exports;
});