Mark a task as complete using Shortcuts

This should be the simplest task by using Shortcuts, but unfortunately it seems OmniGroup opted to make it a “developers only” feature, as in you need to know javascript to do almost anything in Shortcuts.

Can someone help me providing the script to mark the returned item as complete? The Find Available Items action will always return one task only.

Screenshot 2024-01-26 08.46.37

Hi Martin,

Try this:

(async () => {
try {
itemIDs = argument.input
if(itemIDs.length === 0){
throw {
name: “Selection Issue”,
message: “No task IDs were passed into this script.”
}
}
// If a single item is passed in, convert to array
if(!Array.isArray(itemIDs)){itemIDs = new Array(itemIDs)}
itemIDs.forEach(id => {
task = Task.byIdentifier(id)
task.markComplete()
})
}
catch(err){
if(!err.message.includes(“cancelled”)){
await new Alert(err.name, err.message).show()
}
throw ${err.name}\n${err.message}
}
})();