Create new fieldTemplate from code

I have created a fieldtemplate from code and I can see it in the database and it looks like the other templates that are there. But it is not displayed in the list of templates in the BO. Am I missing something important that is needed for the template to show?

Litium version: 7

Restart your website and try.

Ok, It worked. But Is that the only way to make the template visible in the BO?

I am not sure if there are other ways to do this, if so someone else will reply on this thread.

Ok, I hope that someone else can reply then

Do you mind sharing how you create the template from Code, and when, in what phrase do you have that code? The cache should be purged when new template is created.

I have created it as simple as possible so far.

        _fieldTemplateService.Create(new ProductFieldTemplate(id, "Product")
                {
                    ProductFieldGroups = new[]
                        {
                            new FieldTemplateFieldGroup
                            {
                                Id = "General",
                                Collapsed = false,
                                Localizations =
                                {
                                    ["sv-SE"] = { Name = "Allmänt" },
                                    ["en-US"] = { Name = "General" }
                                },
                                Fields =
                                {
                                    "_name"
                                }
                            }
                        },
                    VariantFieldGroups = new[]
                        {
                            new FieldTemplateFieldGroup
                            {
                                Id = "General",
                                Collapsed = false,
                                Localizations =
                                {
                                    ["sv-SE"] = { Name = "Allmänt" },
                                    ["en-US"] = { Name = "General" }
                                },
                            },
                        }
                });

When do you create it? During the time when the website is starting or after it has been started?

It is created after the site has been started because it is triggered by an integration

Ok, sounds like a bug. Please file a bug with concrete steps to reproduce.