Open Closed

Generate to Text Template from Ui #10310


User avatar
0
Srnk created

Hello, I am using the commercial version of ABP.io and I have a question regarding the Text Template module. As far as I understand, text templates need to be defined within the project and ABP provides a page for managing text templates (url is text-template-management/text-templates). My question is: Is there a way to create a new text template directly from that the page? If creation is supported, could you please explain the recommended approach or how can insert a new template in Abp text template page?

Thx


2 Answer(s)
  • User Avatar
    0
    AI-Bot created
    Support Team ABP Agent
    1. Solution
    • The Text Template Management UI (text-template-management/text-templates) does not create new template definitions.
      It only lets you edit / localize the contents of templates that are already defined in your application.

    • To have a template show up on that page, you must first define it in code using a TemplateDefinitionProvider.
      After that, the template will appear in the UI and you can manage its content there (per tenant, per culture, etc.).

    Step‑by‑step: define a new template that appears in the UI

    1. Create a template definition provider in your domain (or application) layer:
    using Volo.Abp.TextTemplating;
    
       public class MyTemplateDefinitionProvider : TemplateDefinitionProvider
       {
           public override void Define(ITemplateDefinitionContext context)
           {
               context.Add(
                   new TemplateDefinition(
                       "MyApp.MyCustomEmail",                  // Template name (key)
                       displayName: "My Custom Email",        // What you see on the UI
                       layout: StandardEmailTemplates.Message // Optional: use standard email layout
                   )
                   .WithDefaultCulture("en")                  // Optional
               );
           }
       }
    
    1. Ensure the assembly that contains MyTemplateDefinitionProvider is loaded by an ABP module (normally it is if it’s in your main project).

    2. Run the app and navigate to
      /text-template-management/text-templates.
      You should now see “My Custom Email” in the list. From there you can:

      • Edit the template content (HTML/text),
      • Localize it per language,
      • Override it per tenant.

    Summary

    • No: You cannot create a brand‑new text template definition purely from the Text Template Management page.
    • Yes: You can create the definition in code (once), and then maintain its content entirely from the UI afterwards.
    1. Sources
    • Text Template Management module docs
      https://abp.io/docs/latest/modules/text-template-management
    • Community article showing definition in code + UI usage under “Text Template Management” section
      https://abp.io/community/articles/jkeb8zzh

    This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    : Is there a way to create a new text template directly from that the page?

    How do you plan to use this new text template?

    I mean, the new name is unknown/dynamic. Where do you use it?

    Thanks.

Learn More, Pay Less
33% OFF
All Trainings!
Get Your Deal
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.2.0-preview. Updated on January 09, 2026, 07:22
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.