Skip to content

Enable / disable script in context menu based on object field values #2487

Closed
@mtrezza

Description

@mtrezza

New Feature / Enhancement Checklist

Current Limitation

Currently, a script is visible in the data browser cell context menu based on the object class and (soon) object field.

Feature / Enhancement Description

Enable / Disable script in context menu based on a combination of object field values. The script should be shown but grayed out in the context menu, so that the dashboard user knows that a script is available but currently disabled based on field values.

Example Use Case

For example, a purchase transaction in which there is a buyingUser and sellingUser, but only the buyingUser can be flagged:

"apps": [
  {
    "scripts": [
      {
        "title": "Flag fraudulent purchase",
        "classes": ["Transaction$buyingUser"],
        "requiredObjectValues": {
           "completed": true,
           "status": 1,
           "country": "US"
        },
        "cloudCodeFunction": "flagUser"
      }
    ]
  }
]

The conditions should support bool, string, number types and conditions should be AND related, i.e. all conditions need to be met for a script to be enabled. The default (if no conditions are set if that no fields are required and the script is always enabled.

There may be a better syntax for how to define these conditions, especially considering possible future additions (see below).

Possible Future Extension

  • Support combinations AND, OR
  • Support comparative conditions like <, >=, !=

Metadata

Metadata

Assignees

No one assigned

    Labels

    bounty:$50Bounty 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