Closed
Description
New Feature / Enhancement Checklist
- I am not disclosing a vulnerability.
- I am not just asking a question.
- I have searched through existing issues.
Current Limitation
Currently, it cannot be determined which field was been selected when a script has been invoked.
Feature / Enhancement Description
Pass the selected field as a separate parameter to the Cloud Function payload.
For example the dashboard user should be able to invoke a script on a user in a specific field of the selected object:
- Transaction class: buying user, selling user
Knowing only the "transaction" object is not enough to know on which user the Cloud Function should be executed.
Example Use Case
Parse.Cloud.define('deleteUser', async (req) => {
const selectedTransaction = req.params.object;
selectedTransaction.set('invalid', true);
await selectedTransaction.set.save(null, { useMasterKey: true });
const selectedUser = req.params.selectedField;
if (selectedUser instanceof Parse.User) {
selectedUser.set('deleted', true);
await selectedUser.save(null, { useMasterKey: true });
}
});
Alternatives / Workarounds
None.