Ask AI
Skip to main content

Convert text to a file

Function: Convert text to a file

This function allows you to take any piece of text and transform it into a file. This newly created file is then automatically saved into your platform's built-in Media Library. This is useful for generating reports, saving user-entered notes, or creating dynamic content that needs to be stored as a document.

Input,

  • Text (STRING): The actual content you want to put inside the file. This can be a simple sentence, a long paragraph, or even dynamically generated text from other parts of your application.
  • Filename (STRING): The name you want to give to your new file. For example, "MeetingNotes" or "Invoice_Report". The system will automatically add the .txt extension.

Output,

  • Result (FILE): This is the name of a variable where the unique identifier (ID) of the newly created file in the Media Library will be stored. You can then use this ID in other actions to reference, display, or download the file. By default, this variable will be named TEXT_FILE if you don't specify a different name.

Execution Flow,

Real-Life Examples,

  1. Saving User Notes:

    • Inputs:
      • Text: "Customer feedback for product X: Users love the new interface but want more customization options."
      • Filename: "CustomerFeedback_ProductX"
    • Result: A file named "CustomerFeedback_ProductX.txt" is created in the Media Library. Its unique ID is stored in a variable named TEXT_FILE, which you can then link to a customer record.
  2. Generating a Simple Report:

    • Inputs:
      • Text: "Daily Sales Report - {{CurrentDate}}\nTotal Sales: $1,250.00\nNew Customers: 5" (assuming \{\{CurrentDate\}\} is a dynamic value from another action)
      • Filename: "Sales_Report_{{CurrentDate}}"
      • Result Variable Name: "DailyReportFileID"
    • Result: A file named "Sales_Report_2023-10-27.txt" (or today's date) is created in the Media Library with the report content. Its unique ID is stored in the variable DailyReportFileID.
  3. Archiving Email Content:

    • Inputs:
      • Text: "Subject: Project Update\nFrom: [email protected]\nDate: 2023-10-26\nBody: The project is on track for completion next week. Please review the attached documents."
      • Filename: "Email_ProjectUpdate_20231026"
    • Result: A file named "Email_ProjectUpdate_20231026.txt" is created in the Media Library, containing the full email text. Its unique ID is stored in the variable TEXT_FILE, allowing you to easily retrieve this archived email later.