Mutli Url Picker not setting content in NotificationHandler
I'm using Umbraco version 9.4.3 and I've created a ContentSavingNotification handler that will call an external API and download some product information, then I set the values of the properties in the content. This is working fine for the Text properties I set but it doesn't work for the Multi Url Picker (MUP).
As part of the information from the API there is a list of image URLs hosted on an external CDN, I don't want to upload these to the Media Libary and just want to store them as links, so I'm using a MUP property to store the links (its usually about 4 or 5 URLs).
According to the docs I should be able to build a list of Links, serialise the list to json and set the MUP value to the json string, but when I do this the MUP value is always empty - it never seems to get set.
This is how I'm setting it in my handler:
//build up a list of url links to the images
var imageLinks = new List<Link>();
for (int a = 0; a < item.Images.Count(); a++)
{
var image = item.Images.ElementAt(a);
imageLinks.Add(new Link
{
Target = "_blank",
Name = $"Item-Image-{a}",
Url = image.URL,
Type = LinkType.External,
});
}
//serialise the links to json
var links = JsonConvert.SerializeObject(imageLinks);
//and save it in the content
content.SetValue("amazonProductImages", links);
I've confirmed the json string is correct and there are no exceptions being thrown (some of the text properties are set after this code and they're working fine).
Mutli Url Picker not setting content in NotificationHandler
I'm using Umbraco version 9.4.3 and I've created a ContentSavingNotification handler that will call an external API and download some product information, then I set the values of the properties in the content. This is working fine for the Text properties I set but it doesn't work for the Multi Url Picker (MUP).
As part of the information from the API there is a list of image URLs hosted on an external CDN, I don't want to upload these to the Media Libary and just want to store them as links, so I'm using a MUP property to store the links (its usually about 4 or 5 URLs).
According to the docs I should be able to build a list of Links, serialise the list to json and set the MUP value to the json string, but when I do this the MUP value is always empty - it never seems to get set.
This is how I'm setting it in my handler:
I've confirmed the json string is correct and there are no exceptions being thrown (some of the text properties are set after this code and they're working fine).
Anyone got any ideas on why it's not working?
I Updated to Umbraco 9.5.2 and it started working...
is working on a reply...