How to do undo right after 'LinkDrawn' event is fired?

Hi Team,

I want to remove a link right after a ‘LinkDrawn’ event is fired based on that link’s from property.
Kindly help me to solve this problem.

Thanks

      $(go.Diagram, . . .
          {
            . . .,
            "LinkDrawn": function(e) {
              var link = e.subject;
              if (link.fromNode...) e.diagram.remove(link);
            },
            . . .
        })

Or:

            "LinkDrawn": function(e) {
              e.diagram.currentTool.transactionResult = null;
              e.diagram.currentTool.doCancel();
            },

Thanks a lot Walter :)