doSomething and doAnotherThing are not attributes, they are methods and should be at the Lifecycle callback level. Try something like this:
module.exports = { attributes: { name: { type: 'string', required: true } }, doSomething: function(cb) { console.log('Lets try ' + "this.doAnotherThing('this')"); this.doAnotherThing('this') cb(); }, doAnotherThing: function(input) { console.log(input); }, beforeCreate: function(values, cb) { this.doSomething(function() { cb(); }) } };
In second place, you are trying to send this.doAnotherThing ('this') to the console, but this is an instance of the model, so you cannot pass it as a parameter to the "Try to try" field. Instead, try this function separately and it will work
crlsmtzprds
source share