Refresh task editor once task updated

Hello to all,

I’ve got a nice Kitchen Display but I dont like how it handles Voids (creates a new task on the KD, both tasks get copied to Waiter screen etc.)

I want to update the existing task by changing color, adding a “Void!” notice etc. The idea is that the existing task would be updated without adding duplicate Void tasks and it wouldnt be sent to Waiter screen.

The thing is that once I update the task, the Task editor does not refresh - I have to enter and exit design mode for the new task content to show up.

This is how I do it - script:

function setTaskAsVoid(taskType, ident){

var resp = gqlEXEC(getTask(taskType, ident));	
resp = JSON.parse(resp);
var task =!=null ? : null;

//takhle se sahá na content:
var content = task.content;
var newcontent = content + ' VOID';

//takhle se sahá na customdata:
var customdata = task.customData;
var customdata1 = customdata[0].name+':'+customdata[0].value;

var update = gqlEXEC(updateTaskByIdentifier(taskType, ident, '', '', '', newcontent, ''));


function getTask(taskType, ident) {
    var q = '';
        q+= '{task:getTask(';
        q+= 'taskType:"'+taskType+'"';
        q+= 'identifier:"'+ident+'"';
        q+= ')';
        q+= '{id,isCompleted,identifier,name,state,content,contentText,customData{name,value},stateLog{state,start,end},stateDuration{state,duration},startDate,endDate,userName}';
        q+= '}';
    return q;

function gqlEXEC(query, callback) {
	//return query;
    var data = gql.Exec(query);  // returns JSON as String
    var dobj = JSON.parse(data); // converts JSON String to Object
    return data;
   function updateTaskByIdentifier(taskType, taskIdent, isCompleted, taskName, customData, content, state){
    var q = 'mutation m {';
        q += 'updateTask (';
        q += 'identifier:"'+taskIdent+'"';
        q += ', taskType:"'+taskType+'"';
        q += ', task:{';
        q += 'taskType:"'+taskType+'"';
        q += (isCompleted!='' ? ',isCompleted:'+isCompleted : '');
        q += (taskName ? ', name:"'+taskName+'"' : '');
        q += content ? ',content:"'+content+'"' : '';
        q += state ? ',state:"'+state+'"' : '';
        q += ',customData:[';
        if (customData) {
            for (var d=0; d<customData.length; d++) {
                q+= (d==0 ? '' : ',');
                q+= '{name:"'+customData[d].name+'",value:"'+customData[d].value+'"}';
        q+= ']';
        q += '}';
        q += ')';
        q+= '{id,isCompleted,identifier,name,state,content,contentText,customData{name,value},stateLog{state,start,end},stateDuration{state,duration},startDate,endDate,userName}';
        //q += '}';
    	q += '}';
    return q;

Void rule:


If I solve this I could create a nice and straightforward kitchen display and waiter screen which I would love to share with the forum.

Any help would be much appreciated.
Thank you, Ondra

Never mind, I found a different solution that refreshes well.

Now I need to find a way how to deal with multiple orders that were partially voided.