Javascript Conditions - Marking Communications as complete

Hi,

Is it possible to have a Javascript condition mark a task as complete?

In our workflow we have a task that is created on an early rule in the workflow.

If the workflow reaches our 'Payment Received' rule before the task is due to fire then we want the task to me marked as complete so it doesn't ever fire off.

Would it be something like:

Update=(NewSale.comm_status=='Complete');

Thanks,

Will Howard