cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to destroy files using JavaScript

Pedro_Merces
Champ in-the-making
Champ in-the-making

Hi,


I'm trying to create a JavaScript file that destroy files when possible. However, I'm not finding a way to do that since, aparently, doesn't exist a document.destroy.

Is there some especific function that does this?

15 REPLIES 15

Can you provide a reference for that "destroy" function? Is something coming from the Java API?

Hyland Developer Evangelist

https://hub.alfresco.com/t5/alfresco-content-services-hub/records-management-user-guide/ba-p/289598

This link shows the properties of some functions, including the rmaSmiley TonguerocessDestruction, which represents the destroy function. However when I try to get the boolean value of it, it returns undefined.

So you are using Record Management module with Enterprise (following the DOD 5015.2 structure).

In order to get the value of that property (rmaSmiley TonguerocessDestruction), the node type needs to a file plan (rma:filePlan).

Is your node of this type?

Hyland Developer Evangelist

Yes, my node is a file plan.

And the result of the following line is null?

var destroy = document.properties["rma:processDestruction"];

That may indicate also false. Does this make sense?

Hyland Developer Evangelist

my code is:

if (document.properties["rmaSmiley TonguerocessDestruction"] == true){

     document.properties["rmc:TipoDeDocumento"] = "success";

}

else if (document.properties["rmaSmiley TonguerocessDestruction"] == false){

     document.properties["rmc:TipoDeDocumento"] = "error";

}

else{

     document.properties["rmc:TipoDeDocumento"] = "none";

}

document.save();

But it only changes to none.