So do you
ever needed to reset a sitecore item field to its standard values? You may know
that you can do that from content editor for presentation details or insert
options for one item at a time. But what if you need to do that for all items
related to specific template? Can we do that programmatically?!
Yep you are
lucky! Sitecore give you the ability to reset item fields to their standard
value using back end code and in this post I will show you how you can do that!
Yes you have to love SITECORE! :) J
I will show
you two quick demo of how to reset presentation details and insert options from
code with only couple of lines of code;
Let’s start
with resetting the insert options for items of a specific template, you need to
know that the insert options is saved on a standard field with a name “__masters”,
check the following code:
The same
idea will be applicable for resetting the presentation details of an item, but
in this case our target field will be “__renderings”, check the following code:
That’s it! You
may need to know that this is applied to all item field, in other words you can
reset any field to its standard value.
Hope this
will help!
1 comment:
Exellent....:)
I really appreciate shared this information, sitecore online training
Post a Comment