Is it possible to cancel a mutation conditionally inside of a trigger.before function? Specifically I’m trying to create a version of an upsert operation but I’d like to use the trigger.before rather than a resolver so that it’s run no matter where the operation is being triggered (nested or not).
Trigger.before is the right approach and simply by adding an Error object to the response array (or using @Fomich’s approach) you’ll be able to cancel the mutation. Make sure you set the trigger to execute both on create, update, and delete operations if each of them are relevant to what you’re working on!