module.exports = function(ClientObservation) { ClientObservation.validate('text', isEnabled, {message: 'Se debe rellenar el campo de texto'}); function isEnabled(err) { if (!this.text) err(); } ClientObservation.observe('before save', function(ctx, next) { ctx.instance.created = Date(); ctx.instance.employeeFk = 20; next(); }); };