Limit 'run' button selection to 1 item in Grid application

I am using on a Grid module the run button to select lines. I have a case where only 1 line can be processed. So I would like to given an error message when the user selects more than 1 line. I tried to use macro sc_err_message on the ‘on record’ or ‘on finish’ php code, but it would not be executed. Does anybody have an idea on how to solve this problem ?

Did you ever find a solution? I have a similar need and cant make it work