Using JavaScript for commands
In addition to using Power Fx to implement the logic for a command's action, you can also use JavaScript. Consider using JavaScript instead of Power Fx for the following reasons:
You already have logic written in JavaScript from a classic command bar command.
You want the command to be available across multiple apps that use the same table, without duplicating the command or Power Fx logic.
You want the command to be available globally within your environment, bound only to the command bar location—not to a specific app or table.
To implement a command's action using JavaScript, follow these steps:
Create a file that contains the JavaScript function.
Upload the file as a JavaScript library.
Create the new command.
Set the action type to Run JavaScript.
Select the uploaded JavaScript library.
Enter the name of your JavaScript function.
Configure the parameters required by your function.
The following video demonstrates how to implement a command using JavaScript.