Setting pricelist name

Hi!

I am creating pricelists in code in a scheduled task(ITask).
It works well, but I would like to set the name property for the pricelists, but it doesn’t seem to get saved.

I am using this code, but when i look in backoffice the pricelist has no name

    public PriceList CreatePriceListConnectedToOrganization(Organization organization, Currency currency, string priceListId, string name)
    {
        var priceList = new PriceList(currency.SystemId);
        priceList.Active = true;
        priceList.Id = priceListId;
        priceList.IncludeVat = false;
        priceList.Localizations.CurrentUICulture.Name = name;
        priceList.Localizations.CurrentCulture.Name = name;
        priceList.OrganizationLinks = new List<PriceListToOrganizationLink>()
        {
            new PriceListToOrganizationLink(organization.SystemId)
        };
        _priceListService.Create(priceList);
        return priceList;
    }

And this is the result

Am i supposed to set the name some other way?

Litium version: 7.2.0

You need to add the name with the culture key as index.
priceList.Localizations["sv-SE"].Name = name;

You can use the LanguageService to get all languages in the solution.

Thanks!

        foreach (var language in _languageService.GetAll())
        {
            priceList.Localizations[language.CultureInfo].Name = name;
        }

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.