5

I've created a new file template called Code which contains many of the same fields as the File template but does not inherit it. While publishing using the Sitecore Publishing Service the blob data does not appear.

Field: Missing attachment

Empty attachment field

Settings: sc.global.xml

<Settings>
  <Sitecore>
    <Publishing>
      <ConnectionStrings>
        <Master>user id=sa;password=pass123;data source=(local);database=demo.dev.localsitecore_Master;MultipleActiveResultSets=True;</Master>
        <Core>user id=sa;password=pass123;data source=(local);database=demo.dev.localsitecore_Core;MultipleActiveResultSets=True;</Core>
        <Web>user id=sa;password=pass123;data source=(local);database=demo.dev.localsitecore_Web;MultipleActiveResultSets=True;</Web>
      </ConnectionStrings>
      <LogLevel>Information</LogLevel>
    </Publishing>
  </Sitecore>
</Settings>
2
  • Has the attachment file also been published? Oct 9, 2016 at 12:33
  • Yes. The attachment field type is an existing field that is published. Oct 9, 2016 at 14:51

1 Answer 1

8

By default, the publishing service will publish Blobs if they are created/referenced by the following fields:

  • /sitecore/templates/System/Media/Versioned/File/Media/Blob Guid = {DBBE7D99-1388-4357-BB34-AD71EDF18ED3}

  • /sitecore/templates/System/Media/Unversioned/File/Media/Blob Guid = {40E50ED9-BA07-4702-992E-A912738D32DC}

In case of you defined your own field, you will need to configure the publishing service to use it. In order to do that, you can pass the new field Id to the RequiredPublishFieldsResolver options (check the sc.publishing.services.xml). Should be something like:

<Settings>
  <Sitecore>
    <Publishing>
     <Services>
      <RequiredPublishFieldsResolver>
      <As>Sitecore.Framework.Publishing.IRequiredPublishFieldsResolver, Sitecore.Framework.Publishing.Service.Abstractions</As>
      <Type>Sitecore.Framework.Publishing.RequiredPublishFieldsResolver, Sitecore.Framework.Publishing</Type>
      <Options>
        <AdditionalMediaFieldsIds>
          <Id>**The Guid of your Blob Field**</Id>
        </AdditionalMediaFieldsIds>
      </Options>
      </RequiredPublishFieldsResolver>
     </Services>
    </Publishing>
   </Sitecore>
  </Settings>

You can put this in a file (for example codefield_patch.xml) and place it in the global folder of the Publishing Service. This will mean it will be available for all environments (You can place it in 'developement' or 'production' folders to be environment specific - See the install guide for more info about these options)

Hope this helps

4
  • If I want to patch it where should the file be placed and recommend name? Oct 9, 2016 at 19:37
  • 2
    I would put it config/global/sc.global.xml. this file has already some useful comments about how to patch the configuration of the publishing service Oct 9, 2016 at 19:46
  • 4
    Ive made an edit to fix this .. waiting for peer review :) Oct 9, 2016 at 19:51
  • 1
    Just a note if you need to add multiple field ids, the element names need to be unique. e.g. ...<Services> <RequiredPublishFieldsResolver> <Options> <AdditionalMediaFieldsIds> <Id1>B7ACF9B9-297F-45D2-943C-1B444B1C36FC</Id1> <Id2>FBC38F77-97B6-49D0-9F2A-C808F5B0CD42</Id2> </AdditionalMediaFieldsIds> </Options> </RequiredPublishFieldsResolver> </Services>... Oct 11, 2016 at 9:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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