Create a Script Button in a Datamining Report

Modified on Thu, 01 Feb 2024 at 10:53 AM

It's useful to be able to call a script from a DMR which is published to the web. Here's how:


1. Prerequisites

  • Administration -> [Module] -> Portal
  • Tick Allow Publish DMR (authenticated and/or anonymous depending on requirements)
  • Save Changes
  • Restart the ManagementStudio client

2. Create the Script

  • Administration -> [Module] -> PowerShell Scripts -> Select module -> Click here to add new item
  • Add the script contents. An example to move a User Migration to a specific process would be:
Move-MSUserMigrationProcesses -MigrationIds @($ScriptArgs.Items) -ProcessName "4. Migrating" -SubProcessName "Migration Commenced" | Out-Null
  • Click OK
  • In the column picker add the Exec via URL column
  • Tick Exec via URL
  • Save Changes
  • Make a note of the script's Id

3. Create the Datamining Report

  • Browse to the relevant module
  • Create a new report and add the required fields
  • Click Add Expression Column
  • Add a Name for the button
  • Change the Button Type to Script Button
  • Add the Script Id
  • Click Run Datamining Report

  • Click Save -> tick Adv. Options -> Publishto Web URL (either authenticated or public) -> Save New

  • Click Menu -> Web / Power BI Endpoint
  • Click the button to copy the DMR URL to the clipboard

4. Test the Script Button

  • Open the URL in a web browser
  • The new button should be displayed. Clicking this will run the script for that User Migration, in this case moving them to a new process