Remove rma:cutoff aspect from record

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Customer

Remove rma:cutoff aspect from record

In our file plan, a retention schedule was assigned to a records category that really makes no sense but now means that the records contained within can no longer be moved or it's metadata edited.

Retention Steps:
1 Cut Off after 2 year(s)
2 Retain after 1 year(s)

After a record makes it through the above steps, we can no longer undo the cutoff which then means there's no way to edit the metadata or move the record to another folder.  The undoCutoff action is no longer available when a record reaches the end of this lifecycle.

Again, this retention schedule should not have been set up this way but can anyone think of a way to remove the rma:cutoff aspect at least so the records can be re-filed to a properly setup category?  Worst case is that the record category is recreated with the proper disposition schedule and then the records are copied to it but that loses and existing links or history on these records.

 

Thanks,

Neil

3 Replies
Highlighted
Moderator
Moderator

Re: Remove rma:cutoff aspect from record

I am not exactly sure about the problem and impacts of removing aspect. However, to remove the aspect from documents you can create a cleanup webscript for finding the nodes matching certain condition and remove the aspect.

E.g. :

 

main();

function main(){
        //example aspectName: rma:cutoff
	var aspectName = args["aspectName"];
        //example objectType (content type): rma:nonElectronicDocument
	var objectType = args["objectType"];
        //example site short name: rm
	var siteShortName = args["siteShortName"];
	var skipCount = (args["skipCount"]==null || args["skipCount"]==undefined)?0:args["skipCount"];
	var maxCount = (args["maxCount"]==null || args["maxCount"]==undefined)?100000:args["maxCount"];
	
	var successfulNodes = [];
	var errorNodes = [];
	//Append the folder path after document library if its known. 
	var query = 'PATH:"/app:company_home/st:sites/cm:' +siteShortName+'/cm:documentLibrary//*" AND TYPE:"'+objectType+'" AND ASPECT:"'+aspectName+'" AND NOT ASPECT:"cm:lockable"';
	var page = {
	  skipCount : parseInt(skipCount),
	  maxItems : parseInt(maxCount)
	};

	var searchQuery = {
	  query : query,
	  language : "lucene",
	  page : page
	};
	
 	logger.log("Search Query: "+query)
 	var nodes = search.query(searchQuery);
 	logger.log("Resulted nodes: "+nodes.length)

	for each(node in nodes) {
		try {
			if(node.hasAspect(aspectName)){
			   node.removeAspect(aspectName);
			   successfulNodes[node.nodeRef] = node.name+" - Aspect Removed!";
			}
		} catch(ex) {
			logger.log("Failed to remove aspect due to: "+ex.message);
			errorNodes[node.nodeRef] = node.name+" - Aspect could not be removed due to: "+ex.message;
		}
	}
	model.successfulNodes = successfulNodes;
	model.errorNodes = errorNodes; 

 

Highlighted
Customer

Re: Remove rma:cutoff aspect from record

Thanks for the feedback, the problem here is that the aspect is protected so trying to do a node.removeAspect("rma:cutOff") results in:

 

Failed to execute script 'Javascript Console Script': 0021242095 The user admin does not have the permission to remove the protected aspect rma:cutOff

 

I also can't use the undoCutoff action like the following since the last disposition action was not a Cutoff:

 

var undoCutoff = actions.create("unCutoff");
undoCutoff.execute(node);

So I guess what I'm really asking is if it's possible to remove a protected aspect.  The goal is to be able to edit the metadata for these records without re-importing them as new records (and losing their history).

 

Highlighted
Moderator
Moderator

Re: Remove rma:cutoff aspect from record

Did you looked at this post, might have helpful information pertaining to your use case: https://hub.alfresco.com/t5/ecm-archive/javascript-unable-to-remove-record-cutoff/m-p/105037/thread-...