This question is locked. New answers and comments are not allowed.
The built in cloud code seems to validate some format and range type scenarios but is there a way to query the database to see if a value already exists or if you need to retrieve a value from another content type? Can you check for something like an existing username or email address? If you need to check a value from another Content type to you have to use External HTTP requests?
Something like the following uses the built in validation but I would like to add the ability to query the database to check for existing values.
Thanks,
Brad
Something like the following uses the built in validation but I would like to add the ability to query the database to check for existing values.
Everlive.Events.beforeCreate(function(request, context, done) {
var email = request.data.Email;
var isValid = email && Everlive.Validation.validateEmail(email);
if (!isValid) {
Everlive.Response.setErrorResult('The "Email" field must be a valid email address.', 131, 500);
}
done();
});
Thanks,
Brad