5

I'm experimenting with the new Publish Service in a sandbox environment created with Sitecore Instance Manager. I followed the setup steps and I am able to publish individual items successfully. For example, I blanked out the Default Workflow field on the Sample Item standard values and published it successfully.

I created a new folder under Home, then tried to fill that folder with items using the FillDb.aspx page. That all worked fine, I got a pile of folders and Sample Items under that new folder. However, I cannot publish them.

I've tried Publish Site, Full Republish from the Publishing Dashboard, and clicking on my new folder and doing Publish Item with Publish Subitems checked. Neither my new folder or any of the children will publish. The publish jobs show 0 versions published, save the Full Republish which shows ~4600 items. I generated 100,000 items so that number is way low.

Any ideas what might be going on?

enter image description here enter image description here

  • Can you provide a sample of the configuration you use for the publishing service? – Michael West Oct 18 '16 at 22:27
  • 1
    Perhaps the items you're trying to publish are not in the appropriate workflow state. – Michael West Oct 18 '16 at 22:27
  • Are you running Sitecore in CMS mode only or in xDB mode? One thing to check - if you are running Sitecore in xDB mode, do you have MongoDB installed and running? Check the log file and see if there are MongoDB errors. And if all of the aobve checks out, upload your log file and we can figure it out. – Hetal Dave Oct 18 '16 at 22:53
  • I checked the workflow state already, and prior to generating the items I had cleared it from the std vals of the template. So it's not workflow, it appears to be because the FillDb tool isn't writing some fields the service depends upon. – Chris Sulham Oct 19 '16 at 14:53
14

The problem here is with FillDB .. it uses quite a rough-and-ready script to make items, and so it generates items that do not have a unique revision field (it leaves this field blank so it defaults to the Standard Values field - it does this for quite a lot of the standard fields).

For the Publishing Service to publish an item it must have a valid revision field, this is why it is skipping those items. We use the revision field to track uniqueness of edits to items so we can compare edits of the same version.

What is happening is that the Publishing Service will look at the revision field and see no change (as the Standard Values item has not changed, so its revision field is still the same) and so thinks there is no work to do and skips the item(s).

Are these issues not logged in the publish service log ? If so I will raise this as a bug to provide more user feedback.

  • 2
    You can get more logging information by adding the following override file. Save the following in the config/global folder as sc.logging.json { "Sitecore" : { "Publishing" : { "LogLevel" : "Debug" } } } – Kieranties Oct 19 '16 at 7:59
  • Thanks for the info. I set the logging level to debug in the service, but I don't see any messages about items being skipped. I'll open a bug ticket and reference this thread. – Chris Sulham Oct 19 '16 at 12:52
  • One more comment, if I script out setting that revision field on all these items, the publisher should pick them up then? – Chris Sulham Oct 19 '16 at 12:53
  • 1
    Turns out we are logging them but its in the next release. See Trevors script answer for how to fix/generate correct versions. – Stephen Pope Oct 19 '16 at 14:37
4

As Stephen pointed out, it's a shortcoming of the Fill Db tool. We're hoping to get a fix for this out in the next Sitecore release (but no promises).

In the meantime, you can use the following SQL script to 'repair' your Items.

The first script will report any Item versions that don't have a revision field.

The second script will create a revision field for all Items that don't have one.

This will then allow the Publishing Service to publish all Items correctly.

-- Report all the Versions that have no revision field
SELECT detectedVersion.*, revisionBasedVersion.*
  FROM (
    SELECT ItemId, Language, Version
    FROM VersionedFields vf
    GROUP BY ItemId, Language, Version) AS detectedVersion

LEFT OUTER JOIN (
    SELECT ItemId, Language, Version
    FROM VersionedFields
    WHERE FieldId = '8CDC337E-A112-42FB-BBB4-4143751E123F') revisionBasedVersion
        ON detectedVersion.ItemId = revisionBasedVersion.ItemId AND
           detectedVersion.Language = revisionBasedVersion.Language AND
           detectedVersion.Version = revisionBasedVersion.Version

WHERE revisionBasedVersion.ItemId IS NULL

--

-- Create a revision field for all versions that don't have one
  INSERT INTO VersionedFields (
     Id, 
     ItemId, 
     Language, 
     Version, 
     FieldId, 
     Value, 
     Created, 
     Updated)
  SELECT NEWID(), 
         detectedVersion.ItemId, 
         detectedVersion.Language, 
         detectedVersion.Version, 
         '8CDC337E-A112-42FB-BBB4-4143751E123F', 
         LOWER(CONVERT(NVARCHAR(50), NEWID())),
         GETDATE(),
         GETDATE()
  FROM (
    SELECT ItemId, Language, Version
    FROM VersionedFields vf
    GROUP BY ItemId, Language, Version) AS detectedVersion

    LEFT OUTER JOIN (
        SELECT ItemId, Language, Version
        FROM VersionedFields
        WHERE FieldId = '8CDC337E-A112-42FB-BBB4-4143751E123F') revisionBasedVersion
            ON detectedVersion.ItemId = revisionBasedVersion.ItemId AND
               detectedVersion.Language = revisionBasedVersion.Language AND
               detectedVersion.Version = revisionBasedVersion.Version

  WHERE revisionBasedVersion.ItemId IS NULL
  • Thanks for this Trevor. I ran these scripts on my master DB and it affected ~100,000 items. After which, the first script returns no results. When I go back into the content editor, the Revision field for these items still show the standard value. I ran another Full Publish, and this time the service is telling me that 106667 were affected, but when I switch to the Web db none of those items are in the tree. – Chris Sulham Oct 19 '16 at 14:51
  • Your first sentence implies the script ran successfully, also the behaviour of the Publishing service. Is caching getting in the way of what you are seeing in the content editor? Obviously a restart of everything is an easy way to see. – Trevor Reeves Oct 20 '16 at 8:36
  • It did run successfully, but it did not update the revision field in Sitecore. It was still showing the standard value in content editor, even after I restarted the application. What I wound up doing was writing a Sitecore Powershell script to loop through the items and make a simple edit to each, which forced the statistics fields to write themselves. After that, everything published. – Chris Sulham Oct 20 '16 at 12:59
  • OK. I can't explain why then - I don't get that problem with the content editor when testing it myself (after either clearing all caches or restarting instance). The data is correct on disk for you, and the behaviour of the Publishing Service afterwards supports that. Glad you found a way around it, but not sure why you had to :-) – Trevor Reeves Oct 20 '16 at 15:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.