Issue

When having the powerFLC ThinClientLink or ThickClientLink functions mapped in a powerJobs Processor job like the Sample.TransferItemBOMs job it fails with an "Invalid URL" error if the Vault name contains a space character.


Cause

In the function that generates the link the Vault name is not encoded. This causes the job to fail since a space character must be encoded to "%20" to generate a valid URL.


Solution

To fix this issue modify the functions in the module "coolOrange.powerFLC.Workflows.MappingFunctions.psm1" to encode the Vault name:

  1. Open the moduleĀ "coolOrange.powerFLC.Workflows.MappingFunctions.psm1" from "C:\ProgramData\coolOrange\powerJobs\Modules"
  2. Search for the function "GetVaultThickClientLink"
  3. Replace it with this updated function:
    function GetVaultThickClientLink($entity) {
        if ($entity._EntityTypeID -eq "ITEM") { 
            $objectId = [System.Web.HttpUtility]::UrlEncode($entity._Number)
            $objectType = "ItemRevision"
        } elseif ($entity._EntityTypeID -eq "FILE") {
            $objectId = [System.Web.HttpUtility]::UrlEncode($entity._FullPath)
            $objectType = "File"
        } else {
            return ""
        }
        $serverUri = New-Object Uri -ArgumentList $vault.InformationService.Url
        $hostname = $serverUri.Host
        if ($hostname -ieq "localhost") { $hostname = [System.Net.Dns]::GetHostName() }
        $vaultName = [System.Web.HttpUtility]::UrlEncode($vaultConnection.Vault)
        return "$($serverUri.Scheme)://$($hostname)/AutodeskDM/Services/EntityDataCommandRequest.aspx?Vault=$($vaultName)&ObjectId=$($objectId)&ObjectType=$($objectType)&Command=Select"
    }
  4. Search for the function "GetVaultThinClientLink"
  5. Replace it with this updated function:
    function GetVaultThinClientLink($entity) {
        $id = GetVaultPersistentId -entity $entity
        $serverUri = New-Object Uri -ArgumentList $vault.InformationService.Url
        $hostname = $serverUri.Host
        if ($hostname -ieq "localhost") { $hostname = [System.Net.Dns]::GetHostName() }
        $vaultName = [System.Web.HttpUtility]::UrlEncode($vaultConnection.Vault)
        return "$($serverUri.Scheme)://$($hostname)/AutodeskTC/$($hostname)/$($vaultName)#/Entity/Details?id=m$($id)&itemtype=$($entity._EntityType.DisplayName)"
    }


See Also

HttpUtility.UrlEncode (Microsoft docs)

Copy Hyperlink (Autodesk Knowledge Network)

mapping functions (coolOrange wiki)