User Name Formatter - Captain icon

User Name Formatter - Captain

Formats user names based on input conditions

User Name Formatter - Captain

AI-generated

Overview

This node formats user names based on the presence of first and last names in the input data. It appends a specified suffix to the first name if available, or to the last name if the first name is missing. If both names are missing, it assigns a default name. This is useful for personalizing user data in workflows, such as preparing user names for display or communication.

Use Case Examples

  1. Appending a suffix to the first name 'John' to create 'John جان'.
  2. Appending a suffix to the last name 'Doe' when the first name is missing, resulting in 'Doe گرامی'.
  3. Assigning a default name 'کاربر عزیز' when both first and last names are missing.

Properties

Name Meaning
First Name Suffix Suffix to append to the user's first name if it exists.
Last Name Suffix Suffix to append to the user's last name if the first name is missing but the last name exists.
Default Name Name to assign if both first and last names are missing.
Users Input user data as JSON string; if left blank, the node uses data from the previous node.

Output

JSON

  • json
    • outputResult
      * name - The formatted user name based on the input conditions.

Troubleshooting

  • Ensure the input data contains user objects with 'firstName' and/or 'lastName' properties; otherwise, the default name will be used.
  • If the 'Users' input is left blank, the node expects user data from the previous node; missing data will cause errors.
  • Input user data should be valid JSON objects to avoid processing errors.

Discussion