We have one requirement need to write groovy script to update component node.
1.need to find the list of pages where tab component been used
tab component has multifield where each field has tab id and tab name and can author upto 5 tabs.
2. Once we get the list of pages, we need to find the component with node name navigationtabs
as shown in the below screenshot.
ex: page /content/we-retail/auotmation-support-program has tab component with node name navigationtabs and under this navTabList (multifield name) node will be there and under this 1,2,3,4,5 with nodes if author added 5 tabs. here only 2 tabs are added hence only 1 and 2 node are created.
if we take node 1 has navId and navName and need to get property navId and like that from each nodes 1,2,3,4,5 if there were 5 nodes. then get the navId value and it should be same as node created under node navigationtabs. here in the screenshot can see navId value is "Vendor" and this value should get updated for "By Vendor" node.
Please suggest on how to write groovy script to update node.
1.find the list of pages used tab component
2.then find the node navigationTabs and then find the navTabsList node under that.
3.then find the nodes 1,2,3,4,5 if exists under navTabsList
4.check if navId has property and get the navId property from each nodes 1,2,3,4,5
5.once we get the navId value, find under navigationTabs node and should be same as navId Value under navigationTabs node else it should be updated with navId value.