AI OnAI Off
That is an really old version...
Can you show the entire stacktrace?
One thing that leaps to mind, that you can try, is to set a GroupName and/or AssetType for that new CommerceMedia:
var commerceMedia = new CommerceMedia {
AssetLink = imageRef,
GroupName = "image",
AssetType = sg.core.Constants.Pim.ImageUpload.ImageTypes.MainImageTypeString.ToLower()
};
Hi,
We are developing a online store where we are trying to upload product images in the CMS that should be connected to products.
In the screenshot below we are trying to do the connecting-part.
'imageRef' is the ContentReference to the already uploaded image (uploaded to global assets in the CMS)
'variationContent' contains information about the product that we want to connect 'imageRef' to.
'variationContent.CommerceMediaContent' is the imagelist for the product where we are trying to add the image.
However, when we are trying to save this using the contentrepository it gives us an exception saying that we cannot use System.DBNull as System.String.
(In the biggest if statement we are trying to remove existing images that we want to replace. We can comment this code out and still get the same exception.)
It doesn't seem like anything is being saved in the database. Any ideas?
Versions we are using: EPiServer CMS 9.12 + Commerce 9.24