cancel
Showing results for 
Search instead for 
Did you mean: 

Remove rma:cutoff aspect from record

niele
Champ on-the-rise
Champ on-the-rise

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

4 REPLIES 4

abhinavmishra14
World-Class Innovator
World-Class Innovator

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. :

Make sure you execute the script as admin user

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; 
~Abhinav
(ACSCE, AWS SAA, Azure Admin)

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).

abhinavmishra14
World-Class Innovator
World-Class Innovator

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-...

~Abhinav
(ACSCE, AWS SAA, Azure Admin)

kintu_barot
Star Collaborator
Star Collaborator

I have little different scenario here.

I wanted to automate the 'cutoff' of the records using rules.

But could not find a way.

Regards,
Kintu