Skip to content

Updating Alteryx Workflows

  • November 16, 2023

Background

You have been using your Alteryx server for several years now. It's been long enough that the version of Windows that Alteryx is running on is going to be unsupported soon. Congratulations, it's time for an operating system refresh.

The new Windows server will not have the same name as your current server. Because the name of the Alteryx server is changing, your workflows will have paths to network locations that need to be updated.

In this article, I am going to make some assumptions. The old server is named `ALTERYX01` and the new server is named `ALTERYX02`. Both are joined to the same AD domain. Alteryx is using SAML SSO authentication; the Alteryx gallery has a DNS alias, `alteryx.domain.net` which it is using as the base URL.

 

Workflows are XML

Let's take a look at an example of a workflow that will need to be updated. Opening the file in a text editor, like VS Code, you'll see the XML that your workflow consists of.

<?xml version="1.0"?> 
<AlteryxDocument yxmdVer="2022.3"> 
  <Nodes> 
    <Node ToolID="1"> 
      <GuiSettings Plugin="AlteryxBasePluginsGui.DbFileInput.DbFileInput"> 
        <Position x="319" y="703" /> 
      </GuiSettings> 
      <Properties> 
        <Configuration>  

Recall that the old server is named ALTERYX01. Let's search the text of the file to see if we can find it. `ctrl-f`

search-alteryx01

I found 15!

If I only had the one workflow, this would be as easy as `crtl-h`, search and replace. Unfortunately, this old server has dozens of workflows that will need to be updated.

 

Automation

You didn't think I was going to do this manually, did you? Of course not!

Before we start, let's look at the parameters the script takes. It looks like we need to provide some of these with a value. Specifically, we need to tell it the path to the workflows, the old server's name, and the new server's name.

param (
   [Parameter(Mandatory=$true)]
   [string]$workflowDirectory,
   [Parameter(Mandatory=$false)]
   [string]$filter = "*.yxmd",
   [Parameter(Mandatory=$true)]
   [string]$oldServer,
   [Parameter(Mandatory=$true)]
   [string]$newServer,
   [Parameter(Mandatory = $false)]
   [string]$outputFilePrefix = "ct-"
)

The script will save the file to the same workflow directory. It will append a prefix to the workflow's file name. You can adjust the `outputFilePrefix`.

# Scan directory for workflows 
$workflows = Get-ChildItem -Path $workflowDirectory -Filter $filter 
foreach ($workflow in $workflows){    
    # Using .NET methods to read file and update the server name 
    $content = [System.IO.File]::ReadAllText($($workflow.FullName)).Replace($oldServer, $newServer) 
    # Save as a new file with prefix
    $outputFile = $workflow.Directory.FullName + '\' + $outputFilePrefix + $workflow.name 
    [System.IO.File]::WriteAllText($outputFile, $content) 

} 

Something that is worth noting is that I am not using the native PowerShell cmdlets `Get-Content`, `Select-String`, or `Set-Content` to find and replace the old server's name with the new one.

It is considerably faster to call the .NET methods to directly read the workflow, replace the server's name, and write an updated copy of the workflow.

 

Validation

Now that you have run the script on your workflows, you will want to spot check at least a few of these. to ensure that the changes were successful.

Just like before, open one of the workflows in a text editor, like VS Code. Doing another `ctrl-f` we will see the updated server name.

search-alteryx03

Success!

You can find a copy of the Update-Workflows script here.

RELATED NEWS

Easy Button: Alteryx Server Log Collection

Collecting Logs for Alteryx Support 

Background

Occasionally you may encounter an issue with your Alteryx server that...

by Conrad Kite

The Power of Snowflake and FactSet

The days of hosting big technology and staff or spending thousands to access fast information are over. The Data Cloud...

by Andy Leichtle

Dynamically Swap Images in Tableau with Dashboard Action

I posted a dashboard to Tableau Public recently that I used as a way of playing around a bit more with dashboard...

by Colleen Hayes