Skip to content

Pass selected field to Cloud Function script #2473

Closed
@mtrezza

Description

@mtrezza

New Feature / Enhancement Checklist

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bounty:$20Bounty applies for fixing this issue (Parse Bounty Program)state:releasedReleased as stable versionstate:released-alphaReleased as alpha versionstate:released-betaReleased as beta versiontype:featureNew feature or improvement of existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions