-1

My requirement is to update specific field in the item using scheduler and publish only updated field alone. I don't want to publish whole item. What is the best way to achieve this? One option is I can create another separate item include field which will be updated through scheduler and publish. But I don't want to create separate item for single field.

  • Why would you only want to publish a single field value? The requirement doesn't make sense to me. – Richard Seal Apr 16 at 9:45
  • 1
    The publish only updated field is out of the box with smart publish. but since the publish is item based it can also update other fields, if that really isn't an option the create another separate item is indeed the solution you need. – Jan Bluemink Apr 16 at 11:34
  • Why would you publish at all then? why not just update the item straight in "web" database? – Mark Cassidy Apr 16 at 21:29
  • @RichardSeal - I will have to update only specific field in the item and publish only changes done on this fields to CD targets. This process will be executed through scheduler. I am trying to find out best options to address this requirement. – Harikishore Reddy Janga Apr 17 at 12:00
  • @JanBluemink - Thanks for your reply. Creating separate item would be a right option to address this requirement. – Harikishore Reddy Janga Apr 17 at 12:02
0

One way to do it is to update the item field directly on the master and web database, this approach has it's draw backs, it may not trigger Cache clearing event or index update event on CD servers, but you can trigger that by code, also when publishing from master to web later, changes on the item in master db will override web db changes

Sitecore.Data.Database masterDB = 
Sitecore.Configuration.Factory.GetDatabase("master");
Sitecore.Data.Database webDB = 
Sitecore.Configuration.Factory.GetDatabase("web");
Sitecore.Data.Items.Item itemToUpdate = masterDB.GetItem("{ID}");

//Begin Editing Sitecore Item in master db
itemToUpdate.Editing.BeginEdit();
itemToUpdate["Title"] = "New value";
itemToUpdate.Editing.EndEdit();

itemToUpdate = webDB.GetItem("{ID}");
//Begin Editing Sitecore Item in web db
itemToUpdate.Editing.BeginEdit();
itemToUpdate["Title"] = "New value";
itemToUpdate.Editing.EndEdit();
  • Thanks for your reply. Yes I will try updating directly in web and master same time. But as you mentioned index update or cache clearing might be an issue. – Harikishore Reddy Janga Apr 17 at 11:57

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.