Workflow auto publish on intermediate state

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












4















Is is possible to perform autopublish of item on intermediate, not final state of sitecore workflow?



Sitecore 9.0.1, Admin user.

I have custom workflow with the following states:



  1. Editing

    • Submit


  2. Reviewing

    • Approve (autopublish item to web database)

      • Auto Publish Action


    • Reject (move item to Editing)


  3. Published

    • Approve (autopublish item to production database)

      • Auto Publish Action


    • Reject (move item to Editing)


  4. On Production (final state)

When item goes from Reviewing -> Published state (by approval) - it's not being autopublished. It works only from Published -> On Production.

I've tried to achieve this by Sitecore.Workflows.Simple.PublishAction



workflow



I also tried to wrote custom processor for this and do publish via code:



PublishManager.PublishItem(dataItem, targets, master, isDeep, false, publishRelated); 


or



var po = new PublishOptions(master,
targetDb,
PublishMode.SingleItem,
lang,
System.DateTime.Now);
po.RootItem = dataItem;

Publisher publisher = new Publisher(po);
publisher.Publish();


Code executes, but nothing publishes, no errors in logs.



Is it even possible?










share|improve this question






















  • Sitecore never publishes item which is not in a final workflow state. In your scenario this would mean both Published and On Production states would have to be final states. You may try that but I have no idea if this will work for you.

    – Marek Musielak
    Feb 11 at 13:51






  • 2





    Btw cross posting is not recommended. I suggest you remove one of your questions stackoverflow.com/questions/54598352/…

    – Marek Musielak
    Feb 11 at 13:52















4















Is is possible to perform autopublish of item on intermediate, not final state of sitecore workflow?



Sitecore 9.0.1, Admin user.

I have custom workflow with the following states:



  1. Editing

    • Submit


  2. Reviewing

    • Approve (autopublish item to web database)

      • Auto Publish Action


    • Reject (move item to Editing)


  3. Published

    • Approve (autopublish item to production database)

      • Auto Publish Action


    • Reject (move item to Editing)


  4. On Production (final state)

When item goes from Reviewing -> Published state (by approval) - it's not being autopublished. It works only from Published -> On Production.

I've tried to achieve this by Sitecore.Workflows.Simple.PublishAction



workflow



I also tried to wrote custom processor for this and do publish via code:



PublishManager.PublishItem(dataItem, targets, master, isDeep, false, publishRelated); 


or



var po = new PublishOptions(master,
targetDb,
PublishMode.SingleItem,
lang,
System.DateTime.Now);
po.RootItem = dataItem;

Publisher publisher = new Publisher(po);
publisher.Publish();


Code executes, but nothing publishes, no errors in logs.



Is it even possible?










share|improve this question






















  • Sitecore never publishes item which is not in a final workflow state. In your scenario this would mean both Published and On Production states would have to be final states. You may try that but I have no idea if this will work for you.

    – Marek Musielak
    Feb 11 at 13:51






  • 2





    Btw cross posting is not recommended. I suggest you remove one of your questions stackoverflow.com/questions/54598352/…

    – Marek Musielak
    Feb 11 at 13:52













4












4








4








Is is possible to perform autopublish of item on intermediate, not final state of sitecore workflow?



Sitecore 9.0.1, Admin user.

I have custom workflow with the following states:



  1. Editing

    • Submit


  2. Reviewing

    • Approve (autopublish item to web database)

      • Auto Publish Action


    • Reject (move item to Editing)


  3. Published

    • Approve (autopublish item to production database)

      • Auto Publish Action


    • Reject (move item to Editing)


  4. On Production (final state)

When item goes from Reviewing -> Published state (by approval) - it's not being autopublished. It works only from Published -> On Production.

I've tried to achieve this by Sitecore.Workflows.Simple.PublishAction



workflow



I also tried to wrote custom processor for this and do publish via code:



PublishManager.PublishItem(dataItem, targets, master, isDeep, false, publishRelated); 


or



var po = new PublishOptions(master,
targetDb,
PublishMode.SingleItem,
lang,
System.DateTime.Now);
po.RootItem = dataItem;

Publisher publisher = new Publisher(po);
publisher.Publish();


Code executes, but nothing publishes, no errors in logs.



Is it even possible?










share|improve this question














Is is possible to perform autopublish of item on intermediate, not final state of sitecore workflow?



Sitecore 9.0.1, Admin user.

I have custom workflow with the following states:



  1. Editing

    • Submit


  2. Reviewing

    • Approve (autopublish item to web database)

      • Auto Publish Action


    • Reject (move item to Editing)


  3. Published

    • Approve (autopublish item to production database)

      • Auto Publish Action


    • Reject (move item to Editing)


  4. On Production (final state)

When item goes from Reviewing -> Published state (by approval) - it's not being autopublished. It works only from Published -> On Production.

I've tried to achieve this by Sitecore.Workflows.Simple.PublishAction



workflow



I also tried to wrote custom processor for this and do publish via code:



PublishManager.PublishItem(dataItem, targets, master, isDeep, false, publishRelated); 


or



var po = new PublishOptions(master,
targetDb,
PublishMode.SingleItem,
lang,
System.DateTime.Now);
po.RootItem = dataItem;

Publisher publisher = new Publisher(po);
publisher.Publish();


Code executes, but nothing publishes, no errors in logs.



Is it even possible?







publishing workflow






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Feb 11 at 13:48









Alexandr TurchinAlexandr Turchin

235




235












  • Sitecore never publishes item which is not in a final workflow state. In your scenario this would mean both Published and On Production states would have to be final states. You may try that but I have no idea if this will work for you.

    – Marek Musielak
    Feb 11 at 13:51






  • 2





    Btw cross posting is not recommended. I suggest you remove one of your questions stackoverflow.com/questions/54598352/…

    – Marek Musielak
    Feb 11 at 13:52

















  • Sitecore never publishes item which is not in a final workflow state. In your scenario this would mean both Published and On Production states would have to be final states. You may try that but I have no idea if this will work for you.

    – Marek Musielak
    Feb 11 at 13:51






  • 2





    Btw cross posting is not recommended. I suggest you remove one of your questions stackoverflow.com/questions/54598352/…

    – Marek Musielak
    Feb 11 at 13:52
















Sitecore never publishes item which is not in a final workflow state. In your scenario this would mean both Published and On Production states would have to be final states. You may try that but I have no idea if this will work for you.

– Marek Musielak
Feb 11 at 13:51





Sitecore never publishes item which is not in a final workflow state. In your scenario this would mean both Published and On Production states would have to be final states. You may try that but I have no idea if this will work for you.

– Marek Musielak
Feb 11 at 13:51




2




2





Btw cross posting is not recommended. I suggest you remove one of your questions stackoverflow.com/questions/54598352/…

– Marek Musielak
Feb 11 at 13:52





Btw cross posting is not recommended. I suggest you remove one of your questions stackoverflow.com/questions/54598352/…

– Marek Musielak
Feb 11 at 13:52










1 Answer
1






active

oldest

votes


















4














The piece you're missing is that on that intermediate workflow state (Reviewing, in your example) you need to set the Preview publishing targets field:



Preview publishing targets field



Check your web target in that field for your Reviewing state and the auto-publish action should work as expected.



Note: if your target does not show up in this list, you may need to navigate to the publishing targets (/sitecore/system/publishing targets) and check the Preview publishing target checkbox:



Preview publishing target field






share|improve this answer























  • Now it works, thank you! But it works only when I use Sitecore.Publishing.Publisher. If I use Sitecore.Publishing.PublishManager the item is skipped and not being published. Currently, I don't know the reason of this.

    – Alexandr Turchin
    Feb 11 at 14:16












  • PublishManager works with the below code.. Sitecore.Data.Items.Item item = Sitecore.Configuration.Factory.GetDatabase("master").GetItem("/sitecore/content/Home"); Sitecore.Publishing.PublishOptions opt = new Sitecore.Publishing.PublishOptions(Sitecore.Configuration.Factory.GetDatabase("master"), Sitecore.Configuration.Factory.GetDatabase("web"), Sitecore.Publishing.PublishMode.SingleItem, item.Language, DateTime.Now); opt.RootItem = item; Sitecore.Publishing.PublishManager.Publish(new Sitecore.Publishing.PublishOptions opt );

    – Gobinath
    Feb 11 at 15:09










Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "664"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsitecore.stackexchange.com%2fquestions%2f16663%2fworkflow-auto-publish-on-intermediate-state%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









4














The piece you're missing is that on that intermediate workflow state (Reviewing, in your example) you need to set the Preview publishing targets field:



Preview publishing targets field



Check your web target in that field for your Reviewing state and the auto-publish action should work as expected.



Note: if your target does not show up in this list, you may need to navigate to the publishing targets (/sitecore/system/publishing targets) and check the Preview publishing target checkbox:



Preview publishing target field






share|improve this answer























  • Now it works, thank you! But it works only when I use Sitecore.Publishing.Publisher. If I use Sitecore.Publishing.PublishManager the item is skipped and not being published. Currently, I don't know the reason of this.

    – Alexandr Turchin
    Feb 11 at 14:16












  • PublishManager works with the below code.. Sitecore.Data.Items.Item item = Sitecore.Configuration.Factory.GetDatabase("master").GetItem("/sitecore/content/Home"); Sitecore.Publishing.PublishOptions opt = new Sitecore.Publishing.PublishOptions(Sitecore.Configuration.Factory.GetDatabase("master"), Sitecore.Configuration.Factory.GetDatabase("web"), Sitecore.Publishing.PublishMode.SingleItem, item.Language, DateTime.Now); opt.RootItem = item; Sitecore.Publishing.PublishManager.Publish(new Sitecore.Publishing.PublishOptions opt );

    – Gobinath
    Feb 11 at 15:09















4














The piece you're missing is that on that intermediate workflow state (Reviewing, in your example) you need to set the Preview publishing targets field:



Preview publishing targets field



Check your web target in that field for your Reviewing state and the auto-publish action should work as expected.



Note: if your target does not show up in this list, you may need to navigate to the publishing targets (/sitecore/system/publishing targets) and check the Preview publishing target checkbox:



Preview publishing target field






share|improve this answer























  • Now it works, thank you! But it works only when I use Sitecore.Publishing.Publisher. If I use Sitecore.Publishing.PublishManager the item is skipped and not being published. Currently, I don't know the reason of this.

    – Alexandr Turchin
    Feb 11 at 14:16












  • PublishManager works with the below code.. Sitecore.Data.Items.Item item = Sitecore.Configuration.Factory.GetDatabase("master").GetItem("/sitecore/content/Home"); Sitecore.Publishing.PublishOptions opt = new Sitecore.Publishing.PublishOptions(Sitecore.Configuration.Factory.GetDatabase("master"), Sitecore.Configuration.Factory.GetDatabase("web"), Sitecore.Publishing.PublishMode.SingleItem, item.Language, DateTime.Now); opt.RootItem = item; Sitecore.Publishing.PublishManager.Publish(new Sitecore.Publishing.PublishOptions opt );

    – Gobinath
    Feb 11 at 15:09













4












4








4







The piece you're missing is that on that intermediate workflow state (Reviewing, in your example) you need to set the Preview publishing targets field:



Preview publishing targets field



Check your web target in that field for your Reviewing state and the auto-publish action should work as expected.



Note: if your target does not show up in this list, you may need to navigate to the publishing targets (/sitecore/system/publishing targets) and check the Preview publishing target checkbox:



Preview publishing target field






share|improve this answer













The piece you're missing is that on that intermediate workflow state (Reviewing, in your example) you need to set the Preview publishing targets field:



Preview publishing targets field



Check your web target in that field for your Reviewing state and the auto-publish action should work as expected.



Note: if your target does not show up in this list, you may need to navigate to the publishing targets (/sitecore/system/publishing targets) and check the Preview publishing target checkbox:



Preview publishing target field







share|improve this answer












share|improve this answer



share|improve this answer










answered Feb 11 at 13:53









Dan SinclairDan Sinclair

2,066626




2,066626












  • Now it works, thank you! But it works only when I use Sitecore.Publishing.Publisher. If I use Sitecore.Publishing.PublishManager the item is skipped and not being published. Currently, I don't know the reason of this.

    – Alexandr Turchin
    Feb 11 at 14:16












  • PublishManager works with the below code.. Sitecore.Data.Items.Item item = Sitecore.Configuration.Factory.GetDatabase("master").GetItem("/sitecore/content/Home"); Sitecore.Publishing.PublishOptions opt = new Sitecore.Publishing.PublishOptions(Sitecore.Configuration.Factory.GetDatabase("master"), Sitecore.Configuration.Factory.GetDatabase("web"), Sitecore.Publishing.PublishMode.SingleItem, item.Language, DateTime.Now); opt.RootItem = item; Sitecore.Publishing.PublishManager.Publish(new Sitecore.Publishing.PublishOptions opt );

    – Gobinath
    Feb 11 at 15:09

















  • Now it works, thank you! But it works only when I use Sitecore.Publishing.Publisher. If I use Sitecore.Publishing.PublishManager the item is skipped and not being published. Currently, I don't know the reason of this.

    – Alexandr Turchin
    Feb 11 at 14:16












  • PublishManager works with the below code.. Sitecore.Data.Items.Item item = Sitecore.Configuration.Factory.GetDatabase("master").GetItem("/sitecore/content/Home"); Sitecore.Publishing.PublishOptions opt = new Sitecore.Publishing.PublishOptions(Sitecore.Configuration.Factory.GetDatabase("master"), Sitecore.Configuration.Factory.GetDatabase("web"), Sitecore.Publishing.PublishMode.SingleItem, item.Language, DateTime.Now); opt.RootItem = item; Sitecore.Publishing.PublishManager.Publish(new Sitecore.Publishing.PublishOptions opt );

    – Gobinath
    Feb 11 at 15:09
















Now it works, thank you! But it works only when I use Sitecore.Publishing.Publisher. If I use Sitecore.Publishing.PublishManager the item is skipped and not being published. Currently, I don't know the reason of this.

– Alexandr Turchin
Feb 11 at 14:16






Now it works, thank you! But it works only when I use Sitecore.Publishing.Publisher. If I use Sitecore.Publishing.PublishManager the item is skipped and not being published. Currently, I don't know the reason of this.

– Alexandr Turchin
Feb 11 at 14:16














PublishManager works with the below code.. Sitecore.Data.Items.Item item = Sitecore.Configuration.Factory.GetDatabase("master").GetItem("/sitecore/content/Home"); Sitecore.Publishing.PublishOptions opt = new Sitecore.Publishing.PublishOptions(Sitecore.Configuration.Factory.GetDatabase("master"), Sitecore.Configuration.Factory.GetDatabase("web"), Sitecore.Publishing.PublishMode.SingleItem, item.Language, DateTime.Now); opt.RootItem = item; Sitecore.Publishing.PublishManager.Publish(new Sitecore.Publishing.PublishOptions opt );

– Gobinath
Feb 11 at 15:09





PublishManager works with the below code.. Sitecore.Data.Items.Item item = Sitecore.Configuration.Factory.GetDatabase("master").GetItem("/sitecore/content/Home"); Sitecore.Publishing.PublishOptions opt = new Sitecore.Publishing.PublishOptions(Sitecore.Configuration.Factory.GetDatabase("master"), Sitecore.Configuration.Factory.GetDatabase("web"), Sitecore.Publishing.PublishMode.SingleItem, item.Language, DateTime.Now); opt.RootItem = item; Sitecore.Publishing.PublishManager.Publish(new Sitecore.Publishing.PublishOptions opt );

– Gobinath
Feb 11 at 15:09

















draft saved

draft discarded
















































Thanks for contributing an answer to Sitecore Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsitecore.stackexchange.com%2fquestions%2f16663%2fworkflow-auto-publish-on-intermediate-state%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown






Popular posts from this blog

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?