November Happy Hour will be moved to Thursday December 5th.

ICatalogSystem SaveCatalogEntry - gives an error CreatedBy for ContentDraft can't be empty

Vote:
 

Hi

We are in the process of upgrading to CMS 12 and Commerce 14 While trying to import products/delete resources using ICatalogSystem. This was working in 11/13

Now we get an error related to drafts. Looking into the code it looks that a draft is trying to be created in CatalogEntryAdmin 

_catalogContentSync.CreateDraft(CurrentDto, PrincipalInfo.CurrentPrincipal.Identity!.Name);

but the PrincipalInfo.CurrentPrincipal.Identity!.Name is null and then the whole metod SaveCatalogEntry fails. 

Microsoft.Data.SqlClient.SqlException: 'Cannot insert the value NULL into column 'CreatedBy', table '@ContentDraft'; column does not allow nulls. INSERT fails.
The data for table-valued parameter "@ContentDraft" doesn't conform to the table type of the parameter. SQL Server error is: 515, state: 2
The statement has been terminated.'

I tried adding "DisableVersionSync": "true", in the appsettings. And that kind of worked as it didn't create the draft, but I'm wondering if there are other solutions 

Thanks, 

#313348
Nov 29, 2023 11:56
Vote:
 

I will file a bug for this, thanks for bringing it into our attention, and apologies for the inconvenience. Maybe the workaround is to set PrincipalInfo.CurrentPrincipal before you executing said code? 

#313659
Dec 04, 2023 16:33
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.