I want to replace an item with another item in a Treelist. Basically, the items I want to replace are broken links. Suppose,

There are two items A and B. A is used in a Treelist field, so I want to replace item A with item B in Treelist by using their ID.

Please let me know the optimal solution. Thanks.

  • I think that you should be able to find almost ready-to-use snippet with google serach. Saerch for replace field value sitecore powershell First result that appear for me: blogs.perficientdigital.com/2016/05/25/… The difference is that William replace url, you will have to adjust it to replace item id. – Alan Płócieniak Feb 14 '19 at 16:07
  • @AlanPłócieniak is it possible to replace broken links in treelist with other items? – PSS Feb 14 '19 at 16:09
  • There is Sitecore admin page that allows removing broken links (stackoverflow.com/a/28738468/6149877). But from what I see you need to replace it with other value, am I right? If you just need to get rid of them, follow the link. – Alan Płócieniak Feb 14 '19 at 16:13
  • @AlanPłócieniak I know to remove broken links I can use Sitecore tool, but I have to replace the broken links with other items. I have 4 items[broken] which are selected in more than 100 items in treelist's field. So, here I just want to replace the id of these 4 items in every treelist. – PSS Feb 14 '19 at 16:19
  • Try the link from first comment then. You will have to edit raw values of an item (geekhive.com/buzz/post/2017/02/…). Links to items are represented in Sitecore as GUIDs (pl.wikipedia.org/wiki/Globally_Unique_Identifier). Once you know GUID you are looking for you can find items and then replace field value. – Alan Płócieniak Feb 14 '19 at 16:25

Your Answer

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

Browse other questions tagged or ask your own question.