November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
do you have BookVariant metaclass created? It sounds to me there has been a problem with it
Is this what you mean? Can I try to recreate it or create a new for testing?
/Rickard
I tried this and got the same error.
var model = new Entry
{
Code = "111111",
Catalog = "Books",
EndDate = DateTime.UtcNow.AddDays(100),
EntryType = "Variation",
InventoryStatus = "Enabled",
IsActive = false,
MetaClass = "BookVariant",
Name = "Test 111111",
StartDate = DateTime.UtcNow
};
Then I agree with Quan that smthing wrong with meta class BookVariant. Can you create a similar one for testing?
I would suggest to try these steps:
Hi,
I have restarted the website, still getting error.
I created a new metaclass and got the same error.
I tried with another metaclass that we created in the beginning of the project. Same error.
We have this class for BookVariant. It has worked earlier:
[CatalogContentType(
GUID = "D7C2DC51-74C7-4CB8-A6F4-79CA9A0DD980",
MetaClassName = "BookVariant",
DisplayName = "Book Variant",
Description = "Display book variant")]
public class BookVariant : ByggtjanstVariantBase
{
//properties
}
public class ByggtjanstVariantBase : VariationContent
{
}
The one thing that might have changed is BookVariant inheriting from ByggtjanstVariantBase instead of VariationContent. Could that cause problems?
Thanks,
Rickard
Hi,
ByggtjanstVariantBase should not be the problem here.
Could you check if the contentTypeModel in the following snippet code is not null?
var metaClassId = MetaClass.Load(CatalogContext.MetaDataContext, "BookVariant"); var contentTypeModel = ServiceLocator.Current.GetInstance<MetaClassToContentTypeMap>().GetContentTypeModel(metaClassId);
And is the contentTypeModel pointed to the BookVariant class correclty? (you can check the contentTypeModel.Name)
You could also check the content type if it's correct:
var contentType = ServiceLocator.Current.GetInstance<IContentTypeRepository>().Load(contentTypeModel);
It's weird when it throws that error while the contentTypeModel is correct. I haven't reprocedured it on my local yet...
@Rickard: I'd suggest you to contact developer support service. When we are able to reproduce the problem we will be able to say more.
I was able to look into your setup, and the investigation shows that your BookVariant (and other strongly typed content types ) were not present in the context of ServiceAPI site, which was required as ServiceAPI 5.0 switched to strongly typed content type internally).
We should probably have documented this. However to fix the problem you can have two options:
Hi!
Sorry for late reply. I had to test this several times to believe that it worked and it does work now.
Thank you for your help!!
Rickard
Hi,
I can no longer create entries by calling the service API. We upgraded from 11.8 to 12.2 before summer, and yesterday I updated to 12.5 but it didn't help.
Updating an existing entry works just fine.
This is the error I get:b__9(Object instance, Object[] methodParameters)\\r\\n ... >
Result: "{\"Message\":\"An error has occurred.\",\"ExceptionMessage\":\"There is no contentType registered for: EPiServer.Commerce.Catalog.ContentTypes.EntryContentBase\",\"ExceptionType\":\"System.NotSupportedException\",\"StackTrace\":\" at EPiServer.Core.Internal.DefaultContentRepository.GetDefault[T](ContentReference parentLink, CultureInfo language)\\r\\n at EPiServer.Core.Internal.DefaultContentRepository.GetDefault[T](ContentReference parentLink)\\r\\n at EPiServer.ServiceApi.Commerce.Controllers.Catalog.Persistence.EntryModelCommitter.SaveCatalogEntry(Entry catalogEntry)\\r\\n at EPiServer.ServiceApi.Commerce.Controllers.Catalog.EntryController.PostCatalogEntry(Entry catalogEntry)\\r\\n at lambda_method(Closure , Object , Object[] )\\r\\n at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.
And this is the model I'm using:
var model = new Entry
{
Code = "111111",
Catalog = "Books",
EndDate = DateTime.UtcNow.AddDays(100),
EntryType = "Variant",
InventoryStatus = "Enabled",
IsActive = false,
MetaClass = "BookVariant",
Name = "Test 111111",
StartDate = DateTime.UtcNow
};
Thanks,
Rickard