Custom actions on a button

Lets explore how we can use the button component to perform custom actions

Updated over a week ago

It can often be useful to add a button into your form to perform custom operations like opening a url or even trigging a Power Automate workflow. In this article we will explore how your can do this!

Example 1 - Running your own JavaScript code

One of the powerful features of Team Forms is the capability to execute your own JavaScript code. This capability is not limited to just calculated values but can also be triggered by a button component. In this example we will use JavaScript to launch a URL.

  1. Drag and drop a button component into your form

  2. Under the Display tab change the Action property to Custom. This will reveal a code editor to add custom JavaScript code that will be executed when the button is pressed

  3. Add the following code to launch a website

    window.open('https://teamforms.app/')

Example 2 - Triggering Power Automate Workflow

You can configure a button to call a Power Automate work flow that has been setup with a "HTTP request is received" trigger. To do so set up your flow and copy the URL generated by Power Automate.

  1. Drag and drop a button component into your form

  2. Under the Display tab change the Action property to POST to URL

  3. Past your URL into the button URL field. Now when a user presses the button Team Forms will trigger the Power Automate.

As part of triggering the flow Team Forms will post the form response data in the body of the request.

Did this answer your question?