More in this section

Forums / Bugs & Issues / Saving without workflow !- published when WF enabled

Saving without workflow !- published when WF enabled

2 posts, 0 answered
  1. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    18 Jul 2012
    06 Jul 2009
    Link to this post
    I'm not sure if this has been discussed, but I vaguely remember seeing a thread on it. I tried searching for it but didn't get anywhere...

    I have been testing locally, where my events workflow is disabled. On the live site it is enabled. (this discrepancy was an oversight on my part). after switching my local site to enable workflow, it looks like all the events created on the live site, although they show up as published, are not in the correct "published" workflow status.

    on page load, I run the following code, to show an additional button based on whether or not the item is published (in workflow):

    mgr = new ContentManager("Events");  
    workflowMenu.Command += workflowMenu_Command;  
    var guid = (Guid[])workflowMenu.DataSource;  
    var wf = WorkflowRuntime.Instance.GetWorkflow(guid[0]);  
    if (wf == null) return;  
    var status = (ContentWorkflow)wf.Activity;  
    if (status.ApprovalStatus == ApprovalStatus.Published)  
        Ping.Visible = true

    However, the wf variable comes up null, UNLESS i go back into the event item, then run it through the worfklow (save -> approve -> publish), even though this process already happened on the live site...

    any ideas why this might be happening?

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    12 Sep 2017
    07 Jul 2009
    Link to this post
    Hello SelArom,

    I suggest that you should try using the approach below. In preview mode of a content item I am getting the item id then check the WorkflowStatus.

        protected void Page_Load(object sender, EventArgs e) 
            EventsItemPreview itemPreview = (EventsItemPreview)this.Parent.Parent; 
            Guid contentID = new Guid(CmsHttpRequest.Current.QueryStirng[itemPreview.ParameterKey]); 
            StagedContent content = itemPreview.Manager.GetStagedContent(contentID) as StagedContent; 
            WorkflowInstance inst = WorkflowRuntime.Instance.GetWorkflow(content.WorkflowInstanceId); 
            if (inst != null
                ContentWorkflow workflow = (ContentWorkflow)inst.Activity; 
                if (workflow.ApprovalStatus != ApprovalStatus.Published) 
                    button1.Visible = false

    Let us know if there is anything else that we can do for you.

    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
2 posts, 0 answered