The information which workflows are preselected is stored in user profile.
Below is the code of a sample admin page which you can use to set a workflow to be selected when that user opens Workbox.
Just create aspx page in /sitecore/admin
folder which uses the code below and then open in your browser
http://YOURDOMAIN/sitecore/admin/setactiveworkflow.aspx?workflowid={A5BC37E7-ED96-4C1E-8590-A26E64DB55EA}&username=sitecore\CHOSEN_USERNAME
I used Sample Worfklow id: {A5BC37E7-ED96-4C1E-8590-A26E64DB55EA}
, you can use any other workflow id.
public partial class SetActiveWorkflow : Sitecore.sitecore.admin.AdminPage
{
protected void Page_Load(object sender, System.EventArgs e)
{
CheckSecurity();
var currentUser = Sitecore.Security.Authentication.AuthenticationManager.GetActiveUser();
try
{
var userName = Request["username"];
var workflowId = Request["workflowid"];
if (!string.IsNullOrEmpty(userName) && !string.IsNullOrEmpty(workflowId))
{
Sitecore.Security.Authentication.AuthenticationManager.SetActiveUser(userName);
string registryKey = "P" + System.Text.RegularExpressions.Regex.Replace(workflowId, "\\W", string.Empty);
Sitecore.Web.UI.HtmlControls.Registry.SetString("/Current_User/Panes/" + registryKey, "visible");
// clearing the cache may not be necessary. just in case
var shellSiteContext = Sitecore.Sites.SiteContext.GetSite("shell");
var shellSiteRegistryCache = Sitecore.Caching.CacheManager.GetRegistryCache(shellSiteContext);
shellSiteRegistryCache.RemoveKeysContaining(Sitecore.Context.GetUserName().ToLowerInvariant());
Response.Write($"Workflow {workflowId} selected for {Sitecore.Context.GetUserName()}");
}
}
catch (System.Exception exc)
{
Sitecore.Diagnostics.Log.Error("Exception while setting active workflow", exc, this);
}
finally
{
Sitecore.Security.Authentication.AuthenticationManager.SetActiveUser(currentUser);
}
}
}