Hi All,
Suppose I want to delete two specific properties from a specific component, present on all pages in author.
Which would be the best way to do it. Any code snippet regarding this will be very helpful.
Any thoughts will be really helpful.
Solved! Go to Solution.
Views
Replies
Total Likes
For doing this follow given steps -
first you have to search all pages those contains this component & for doing this you can use search query as shown below -
type=nt:unstructured
path=/content
property = cq:commerceType
property.value=product
This query will return all pages those contains a node having property cq:commerceType & value as product.
Second - Now just remove the properties from these result set resources by -
first adopt these resource into ModifiableValueMap this is a extension of ValueMap in AEM.
Then simply use map.put() method to change the value & the commit the resourceResolver using resourceResolver.commit() method.
It will do what you want.
Happy Coding
Views
Replies
Total Likes
For doing this follow given steps -
first you have to search all pages those contains this component & for doing this you can use search query as shown below -
type=nt:unstructured
path=/content
property = cq:commerceType
property.value=product
This query will return all pages those contains a node having property cq:commerceType & value as product.
Second - Now just remove the properties from these result set resources by -
first adopt these resource into ModifiableValueMap this is a extension of ValueMap in AEM.
Then simply use map.put() method to change the value & the commit the resourceResolver using resourceResolver.commit() method.
It will do what you want.
Happy Coding
Views
Replies
Total Likes
You can write a simple service using JCR API to do that for you !
You can refer this on using JCR API
https://helpx.adobe.com/experience-manager/using/programmatically-accessing-cq-content-using.html
Views
Replies
Total Likes
My favorite tool for this type of thing is the groovy console. Makes doing large scale changes such as this a lot easier
Views
Replies
Total Likes
Hi Bailey,
Thank you for your reply.
Did go through the code, but was not able to understand much.
Do you have any other references/simple code, so that I get some understanding on this.
Views
Replies
Total Likes
Hi Ankur,
Thanks a ton for your reply.
1] http://www.wemblog.com/2014/08/how-to-use-sessions-and-resource.html Looks like this has code similar to what you mentioned. Is that correct?
2] In the search query you provided(taking that as a reference), I want to remove property cq:commerceType from all the pages in author. That can be done based on the code provided in #1[above]?
Your thoughts/pointers will be really helpful.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies