You can try following in your command js. Extensions.YourExnName.prototype.isAvailable = function YourExnName$isAvailable(target) { //check here for publication return true/false;; }; Extensions.YourExnName.prototype.isEnabled = function YourExnName$isEnabled(target) { //check here for publication return true/false; }; 2) Validation can be done using javaScript also in your onclick or other events, did you try?