Cancel button in Task File Card - Doesn't Work

Does anyone know how to identify if the cancel button was pressed in a file card when that card is shown as part of a Task? I have the need to show a file card to retrieve some information from the user but if the user presses cancel the task still completes. I assume the check would have to be done in the script but I can't find the API call.

SolidworksSolidworks Pdm enterprise Pdm