Broken site after 4.2 SP1 upgrade
Hi,
After having upgrading to 4.2 SP1, I get this error when trying to publish a news item:
Culture is not supported.
Parameter name: name
n is an invalid culture identifier
My colleague thinks this could be due to our custom fields.
This is what fields look like in the database, in the sf_news_items table:
(...)
,[links]
,[liens]
,[f_r__docs]
,[f_r__contacts]
,[e_n__docs]
,[e_n__contact]
,[f_r__images]
,[e_n__images]
We've made some progress (or possibly fixed the problem, but I don't want to rejoice too early).
More info:
- Most of our content was automatically imported with a little program we developed, which uses the Sitefinity API
- Only some of the imported content was corrupt, newly-created content works fine
- Only English imported content causes errors (FR-only content is fine, EN-only content crashes, and FR/EN content crashes)
- When looking into the database, table "sf_news_tems", we noticed (among other things) that imported English content has the "approval_workflow_state_" column set to NULL, while content which works fine has this column set to 'Published'
- Taking a random non-working English news item, I manually updated its "approval_workflow_state_" column to 'Published', and now this news item seems to work fine in the back end!
To fix this in our import program, we added the 2nd line:
manager.Lifecycle.PublishWithSpecificDate(sfEvents, ntArticle.PublishedDate, cultLang);
sfEvents.ApprovalWorkflowState =
"Published"
;
Hi Thomas,
Approval workflow records are initialized only when the items goes through the standard workflow. Currently your publishing it through the API, which is not executing the workflow. Please try this code:
/// <summary>
/// Creates a default approval tracking record for the specified item with the corresponding approval tracking records map
/// </summary>
/// <param name="workflowItem">Item</param>
/// <param name="applicationName">Application name</param>
/// <param name="status">Status to set to the item</param>
public static void InitializeApprovalTrackingRecordMap(this IApprovalWorkflowItem workflowItem, string applicationName, string status = "Published")
if (workflowItem.ApprovalTrackingRecordMap == null)
var approvalTrackingMap = new ApprovalTrackingRecordMap() Id = Guid.NewGuid() ;
workflowItem.ApprovalTrackingRecordMap = approvalTrackingMap;
var trackingRecord = CreateApprovalTrackingRecord(workflowItem.Id, applicationName, status);
workflowItem.ApprovalTrackingRecordMap.ApprovalRecords.Add(trackingRecord);
workflowItem.ApprovalWorkflowState = status;
/// <summary>
/// Creates an approval tracking record for the specified item id
/// </summary>
/// <param name="workflowItemId">Item</param>
/// <param name="applicationName">Application name</param>
/// <param name="status"></param>
/// <returns></returns>
public static ApprovalTrackingRecord CreateApprovalTrackingRecord(Guid workflowItemId, string applicationName, string status)
var culture = CultureInfo.CurrentUICulture;
var invariant = CultureInfo.InvariantCulture.LCID;
var cultureId = culture.LCID;
var multilingual = AppSettings.CurrentSettings.Multilingual;
if (multilingual)
if (cultureId == AppSettings.CurrentSettings.DefaultFrontendLanguage.LCID)
cultureId = invariant;
var trackingRecord = new ApprovalTrackingRecord()
ApplicationName = applicationName,
Culture = multilingual ? cultureId : invariant,
DateCreated = DateTime.Now,
Id = Guid.NewGuid(),
LastModified = DateTime.Now,
Note = string.Empty,
Status = status,
UserId = SecurityManager.CurrentUserId,
WorkflowItemId = workflowItemId
;
return trackingRecord;
Please run this before you call the publish method. The application name could be found in the provider: manager.Provider.ApplicationName.
So it should be something like that in your case:
sfEvents.InitializeApprovalTrackingRecordMap(manager.Provider.ApplicationName);
manager.Lifecycle.PublishWithSpecificDate(sfEvents, ntArticle.PublishedDate, cultLang);
Greetings,
Pavel Iliev
the Telerik team