AnsweredAssumed Answered

Multi-language email notifications

Question asked by Axel on Jul 10, 2018

Hi all,

 

I don't have a question but thought I could share some ideas here.

 

It looks like most members of the community are happy with email notifications in english only.

Unfortunately, one of our customers has a legal requirement to offer as well the user interface as the communication in English and French.

My approach is to add a parameter to the workflow that represents the selected UI language in AP. In addition, I will duplicate the "email notification" activity to define a MailBody in English and a second one in French.

Using a run condition for these activites checking the newly created parameter should solve the requirement.

 

Just as a point to start from I added this powershell webservice to my environment and it seems to work well.
Of course, there will be more efficient ways to solve this :-)

 

Hope this helps :-)

Axel

 

--- AP powershell webservice ---

function AP_language {

param( $Username )

 

#Open Database connection to AP database

$connection = New-Object System.Data.SqlClient.SqlConnection
$connection.ConnectionString = "Server=SnowAutomationPlatformSQLServer;
     Database=SnowAutomationPlatformDomain;Trusted_Connection=True;"
$connection.Open()
 
# Build Command string to read UserID from database
$command = New-Object System.Data.SQLClient.SQLCommand
$command.Connection = $connection
$command.CommandText = "SELECT Id FROM dbo.Users where UserId = '$Username';"

 

# read UserID from database
$UserID = $command.ExecuteScalar()

 

# Build next command string to read CurrentCulture for selected User
$command = New-Object System.Data.SQLClient.SQLCommand
$command.Connection = $connection
$command.CommandText = "SELECT [value] FROM dbo.UserSettings where UserId = '$UserID' AND [Key] = 'CurrentCulture';"

 

# Read CurrentCulture from database
$UserLang = $command.ExecuteScalar()

 

# value from db looks like {"value":"de"} - get language code
if ($Userlang.contains("de")) { # German language selected
    $result = "de"
}
Elseif ($Userlang.contains("fr")) { # French language selected
    $result = "fr"
}
Else { # all other language selections
    $result = "en"
}

$Connection.Close() # close database connection

$result

} #End function

Outcomes