Smart Email intake.
Step 3 - Create instant flow to translate

Smart Email intake.
Step 3 - Create instant flow to translate sample data into target language

As we want to support three languages, English, French and German to analyze the Email content, we need to have sample data for each supported language. AI Builder has a Text translation prebuilt model and we can use it to translate the Case Description into a selected target language.

Column Description
Description Holds the plan text email content.
Description Translated Holds the translated to target language “Description” to be used in the AI Builder Category Classification model.
Category Tags

Holds the analyzed category tags of the Description text.

In a first iteration you will add the Category Tags manually.

After you’ve trained models, we’ll include the trained model into the “Automatically create Case records from Email” flow to analyze the Email content and get the Category Tags based on the trained model.

Category Tags Translated Holds the Category Tags to be used in the AI Builder Category Classification model.

Consider how to deal with single or multi-language model support

  • For a multi-language scenario, I recommend to keep the Category Tags in one common language, as we will use the Category Tags later to route the Case using Routing Rules to the skilled Agent. In our case we used English as the common language for tagging the categories.
  • For a single-language scenario, I recommend to translate everything into one common language like English. And just use one common language model to analyze and route the cases.

Prerequisites

Make sure that the following prerequisites are met:

Create Translate Cases to Target Language instant flow

The helper flow should be triggered manually passing a target language code value to translate the Description into the target language and persist it into Description Translated for later used to train the AI Builder model for different language. The building blocks are:

  1. Define the used variables
  2. Check user input
  3. Get list of cases
  4. Translate content to target language
High-level functional process overview with domain options Case Management Create Translate Cases to Target Language instant flow.

Now let’s create the helper flow

  1. Sign in to Power Apps (https://make.powerapps.com/) and then select Flows > Cloud flows.
  2. Select “New flow” and select “Instant cloud flow”
  3. Add the following additional variables steps
  4. Step Initialize variable Target Language Initialize variable Translated Description Initialize variable Translated Category Tag Initialize variable AI Builder Language Initialize variable AI Builder Language Confidence Score Initialize variable Case Description Translated
    Name target _language translated _description translated _category_tag ai_builder _language ai_builder _language _confidence _score case _description _translated
    Type String String String String Float String
    Value en none none en 0 none

    See results

    High-level functional process overview with domain options Case Management Add the following additional variables steps.

  5. Add a Flow Scope step and name it “Check user input”
  6. Add a Condition step to check if user input is a valid supported target language code.
  7. Add in “If yes” a new Flow step Set variable and name it “Set variable Target Language to User Input”. Set Name equal target_language and Value equal User Input target_language.
  8. High-level functional process overview with domain options Case Management Add in “If yes” a new Flow step Set variable and name it “Set variable Target Language to User Input”. Set Name equal target_language and Value equal User Input target_language.

  9. Add a Flow Scope step and name it “Get list of cases”
  10. Add a Dataverse List rows action and name it “List cases”
  11. Select Table name “Cases”
  12. Add Fetch Xml Query to get only active cases with category tags. See below sample
  13. High-level functional process overview with domain options Case Management Add Fetch Xml Query to get only active cases with category tags.

  14. Add a Flow Scope step and name it “Translate content to target language”
  15. Add a AI Builder Step “Detect the language being used in text” and name it “Detect the language being used in case description”
  16. Add a Flow Step “Set variable” and name it “Set variable AI Builder Language”. Choose the “ai_builder_language” variable for Name and for Value “Language” result from the AI Builder.
  17. High-level functional process overview with domain options Case Management Add a Flow Step “Set variable” and name it “Set variable AI Builder Language”. Choose the “ai_builder_language” variable for Name and for Value “Language” result from the AI Builder.

  18. Add a Condition step to evaluate the detected language confidence score is a valid result between 0 and 1.
  19. Add in “If yes” a new Flow step Set variable and name it “Set variable AI Builder Language Confidence Score”
  20. For Name choose the variable “ai_builder_language_confidence_score” and for Value add the AI Builder Confidence Score result.
  21. Add in “If no” a new Flow step Set variable and name it “Set variable AI Builder Language Confidence Score”
  22. For Name choose the variable “ai_builder_language_confidence_score” and for Value add 0.
  23. High-level functional process overview with domain options Case Management Add a Flow Step “Set variable” and name it “Set variable AI Builder Language”. Choose the “ai_builder_language” variable for Name and for Value “Language” result from the AI Builder.

  24. Add a Condition step to evaluate the detected language is a valid result en, fr, de
  25. High-level functional process overview with domain options Case Management Add a Condition step to evaluate the detected language is a valid result en, fr, de

  26. Add in “If yes” a new Flow step switch to evaluate the supported target language model. Set On equal to target_language variable
  27. Add a Switch cases for English language and name it “Language equal english”
  28. Set Equals to en
  29. Add a AI Builder Step “Translate text into another language” and name it “Translate description to english”.
  30. Set Text to Case Description and Translate to English
  31. Add a Flow Step “Set variable” and name it “Set variable Translated Description for english”. Choose the “translated_description” variable for Name and for Value “Translated text” result from the AI Builder.
  32. Add a AI Builder Step “Translate text into another language” and name it “Translate category tag to english”.
  33. Set Text to Case Category Tags and Translate to English
  34. Add a Flow Step “Set variable” and name it “Set variable Translated Category Tag for english”. Choose the “translated_category_tag” variable for Name and for Value “Translated text” result from the AI Builder. See result
  35. High-level functional process overview with domain options Case Management Add a Flow Step “Set variable” and name it “Set variable Translated Category Tag for english”. Choose the “translated_category_tag” variable for Name and for Value “Translated text” result from the AI Builder.

  36. To support other languages too, repeat the steps 21 to 28 for French and German.
  37. Close the switch action
  38. Add a Dataverse Step “Update a row” and name it “Update current case”
  39. Set Table name equal “Cases”, Row ID equal “Case”, Category Tags Translated to translated_category_tag variable and Description Translated to translated_description.
  40. High-level functional process overview with domain options Case Management Set Table name equal “Cases”, Row ID equal “Case”, Category Tags Translated to translated_category_tag variable and Description Translated to translated_description.

    High-level functional process overview with domain options Case Management Set Table name equal “Cases”, Row ID equal “Case”, Category Tags Translated to translated_category_tag variable and Description Translated to translated_description.

  41. Select “Save” to persist all changes you made to the flow.
  42. Select “Test” to test your flow with User Input with a supported language code.

Now we’ve helper flow to simple translate the Case description into any target language. We will use this helper flow to prepare the sample data for the AI Builder models for category classifications.

Steps by step guide
  1. Create a solution “Case Management”
  2. Create a Automatically create Case records from Email ruleset
  3. Create instant flow “TranslateCasesToTargetLanguage”
  4. AI Builder category classification custom model
  5. Extend Automatically create Case flow with AI Builder models
  6. Configure Unified Routing based on Category Tags to Agents

5. Jan 2023