Skip to content

Add support for Action + Forms association #1051

@tsangste

Description

@tsangste

Checklist

Describe the problem you'd like to have solved

I am deploying my actions, forms and flows from staging to production but after deployment I have to manually edit my actions in production to reference these newly deployed forms due to the forms having a different form_id from staging to prod. Also any manual editing would be overwritten when you do another deployment with the cli.

Action code:

exports.onExecutePostLogin = async (event, api) => {
     api.prompt.render('<form_id>');
};

I would love a way where the form_id for forms in actions can be resolved like how flows are done with forms.

Describe the ideal solution

As actions are code files I think the best solution would be to leverage action secrets.

By using actions secrets we could basically create a new secret and set the value of the secret to the form name and during processing of the action (would require to change the order so forms complete before actions) we could retrieve the list of forms to resolve the name to ids to replace the secret value with the form_id

Action Code:

exports.onExecutePostLogin = async (event, api) => {
     api.prompt.render(event.secrets.FORM_ID);
};

YAML Tenant Config:

actions:
  - name: form-action
    code: ./actions/form-action/code.js
    dependencies: []
    deployed: true
    runtime: node22
    secrets:
      - name: FORM_ID
        value: 'new-form'
    status: built
    supported_triggers:
      - id: post-login
        version: v3
forms:
  - name: new-form
    body: ./forms/new-form.json

Alternatives and current workarounds

No current workaround with cli except for manual editing of actions

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestproposalProposing new or revised functionality for comment

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions