This script allows you to have PDFsuite create document tasks on a custom table rather than the PDFsuite Document Task table [x_uxs_pdfsuitedoc_document_task].
The script serves two functions, creating task records and closing them. This will be denoted by the action variable, which will be one of the following values:
When the action is 'CREATE' the following variables are provided:
When action is 'CLOSE' the following variables are provided:
The result of the script should be assigned to the result variable.
{
table: 'TABLE_NAME',
sys_id: 'SYS_ID'
}
or false if unsuccessful. // set up a function that creates a document task record
function create(current, form, user, group, description, shortDescription){
var table = 'x_pre_app.my_task_table'
var gr = new GlideRecord(table);
gr.table = current.getTableName() + '';;
gr.recordID = current.sys_id+'';
gr.form = form+'';
gr.user = user.sys_id+'';
gr.group = group.sys_id+'';
gr.description = description+'';
gr.form = shortDescription+'';
var sys_id = gr.insert();
if(!sys_id){
return
}
return {
table: table,
sys_id: sys_id
}
}
// set up function to close the record
function close(task ){
if(task){
task.state = 'closed';
return task.update();
}
return false;
}
if (action === 'CREATE'){
result = create(current, form, user, group, description, shortDescription);
} else if(action === 'CLOSE'){
result = close(task);
}