Create a Flow for Localized Notifications

Create a flow that uses your Apex action to localize notifications.

This task creates a flow for bell notifications, but you can create a similar flow for email notifications. See App, Push, and Bell Order Confirmations.

  1. From Setup, in the Quick Find Box, enter Process Automation, and select Flows.

  2. Create a flow.

  3. Select Autolaunched Flow, and click Create.

  4. On the Manager tab, click New Resource.

  5. Fill in the New Resource form.

    1. For Resource Type, select Variable.

    2. For API Name, enter UserLanguage.

    3. For Data Type, select Record.

    4. For Object, enter User.

  6. On the Element tab, drag an Action element to the canvas.

  7. Fill in the New Action form.

    1. For Filter By, select Type.

    2. Click Apex Action.

    3. Click Search Apex Actions, and select GetBuyerUserLanguageAction.

    4. For Label, enter Get Buyer Language.

    5. For API Name, enter Get_Buyer_Language.

    6. Under Set Input Values, include orderSummaryIds.

    7. Select Enter value of search resources, and enter {!OrderSummaryRecord.Id}.

    8. Select Manually assign variables (advanced).

    9. Click Search variables, and enter {!UserLanguage}.

    10. Click Done.

  8. On the Element tab, drag a Decision element to the canvas.

  9. Fill in the New Decision form.

    1. For Label, enter Check Buyer Language.

    2. For API Name, enter Check_Buyer_Language.

    3. Fill in the Outcome Detail.

      1. For Label, enter French Buyer.
      2. For Outcome API Name, enter French_Buyer
      3. For When to Execute Outcome, select All Conditions are Met.
      4. For Resource, enter {!UserLanguage.LanguageLocaleKey}, which uses the output of the Apex class created in Localize a Notification.
      5. For Operator, select Equals.
      6. For Value, enter fr.
      7. Click Done.
  10. On the Element tab, drag an Action element to the canvas.

  11. Fill in the Action element form.

    1. For Search All Actions, select Send Custom Notifications.

    2. For Label, enter Notifications for French Buyers.

    3. For API Name, enter Notifications_for_French_Buyers.

    4. For Custom Notification Type ID, enter {!customNotificationRecordId.Id}.

    5. For Notification Body and Notification Title, enter Votre commande a Γ©tΓ© confirmΓ©e. You can also customize this message.

    6. For Recipient IDs, enter {!RecipientId}.

    7. For TargetID, enter {!orderSummaryRecordID.Id}.

    8. Click Done.

  12. On the Element tab, drag another Action element to the canvas.

  13. Fill in the Action element form.

    1. For Search All Actions, select Send Custom Notifications.

    2. For Label, enter Notifications for English Buyers.

    3. For API Name, enter Notifications_for_English_Buyers.

    4. For Custom Notification Type ID, enter {!customNotificationRecordId.Id}.

    5. For Notification Body and Notification Title, enter Your Order is Confirmed. You can also customize this message.

    6. For Recipient IDs, enter {!RecipientId}.

    7. For TargetID, enter {!orderSummaryRecordID.Id}.

    8. Click Done.

  14. Connect your elements. Start connects to getOrderSummaryRecord, connects to getCustomNotificationTypeRecord, connects to assignRecipientId, connects to Get Buyer Language, connects to Check Buyer language, which connects to both Notification for English Buyers and Notification for French Buyers. Notification for English Buyers is the default outcome.

Here’s an example flow with the elements connected.

Example localization flow.