I believe Sitecore is caching an item's workflow value and I need to be able to clear it.
The scenario is that I issue an ajax request to determine whether a specific item exists and if it does exist retrieve its Workflow field value. The user fills out a form and they have the options to Save or Submit that form; when they submit the form it enters a Workflow state. However, even if I switch browsers the LoiHasNoWorkflow
keeps the previous value unless I publish again. I have a method to clear some caches but I'm not sure which might be actually caching the field.
public static bool ClearCache()
{
foreach (DictionaryEntry entry in HttpContext.Current.Cache)
{
HttpContext.Current.Cache.Remove((string)entry.Key);
}
Context.Database.Engines.TemplateEngine.Reset();
Context.ClientData.RemoveAll();
CacheManager.ClearAllCaches();
return true;
}
public bool LoiHasNoWorkflow => CBUtility.ClearCache() && string.IsNullOrEmpty(loi?.Fields["__Workflow"].Value);
How can I determine why the item's __Workflow value won't clear? I can even delete the item through Sitecore UI, refresh the page, and issue the same request but get the value when the item did exist.