You would need to use the on-click property of the command button. Reference: https://support.microsoft.com/en-gb/office/use-a-command-button-to-start-an-action-or-a-series-of-actions-c7bf2827-2f3e-42b8-83d6-6c4f0de78990 https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/user-interface/action-controls