Hello guys, I’m trying to relate the request.object that I receive in a cloud function through afterSave
but the relationship remains blank… this is my code…
Moralis.Cloud.afterSave('eventName', async (request, response) => {
const confirmed = request.object.get('confirmed')
if (!confirmed) {
return true
}
// create and set row
const userD = Moralis.Object.extend('Deposits')
const userDeposit = new userD()
// set
const prop = request.object.get('prop')
userDeposit.set('prop', prop)
// relation
const relation = userDeposit.relation('event') // event is name row on Deposit Class
relation.add(request.object)
// save
await userDeposit.save()
return true
});
If I manage to get a relationship but it says that there are 0 objects, try also with the ID as the doc says but it gave me the discrepancy error.
How could I do it? I need to make only one relationship.