cogRemove all objects of a given class from a given document
Developed by

Vincent Massol

Rating
Rate!
0 Votes
LicenseGNU Lesser General Public License 2.1

Description

Example:

{{velocity}}
#if ($request.confirm == '1')
  #set ($targetDoc = $xwiki.getDocument('Page1.Page2.WebHome'))
  #set ($result = $targetDoc.removeObjects('Page3.Page4.SomeClass'))
  #if ($result)
    #set ($discard = $targetDoc.save('Removed all xobjects'))
    XObjects removed!
  #else
    Error: XObjects not removed!
  #end
#else
  [[Remove XObjects>>||queryString='confirm=1']]
#end
{{velocity}}

Prerequisites & Installation Instructions

Copy the code snippet to a page and save it.

Tags:
Created by Vincent Massol on 2018/07/10 16:02
     

Get Connected