SDK 3 - delete document

cancel
Showing results for 
Search instead for 
Did you mean: 
anakin59490
Established Member II

SDK 3 - delete document

Hi,

i have added button on my form in order to delete a document :

but when i click it , i have the following issue "remove function not found"

This is the javascript code :

I use for that : remove | Alfresco Documentation 

What is missing ?

Thank's in advance

5 Replies
angelborroy
Alfresco Employee

Re: SDK 3 - delete document

Have you tried with document.remove()?

Hyland Developer Evangelist
krutik_jayswal
Senior Member II

Re: SDK 3 - delete document

It depends on which type of object you are calling this method. document.nodeRef will return the string object so it will throw an error.

document.remove() should do the trick , but still as i said it depends on the type of object.

angelborroy
Alfresco Employee

Re: SDK 3 - delete document

Root objects | Alfresco Documentation 

"document" is used to be a ScriptNode object, ready to accept that remove method.

Hyland Developer Evangelist
anakin59490
Established Member II

Re: SDK 3 - delete document

Thank you,

i would like to delete pdf document.

I suppose document.remove() should work because, now, i got a message about acces 

what is the right way to allow this operation ?

Is there a specific method to use before document.remove() or is it in user profil ?

angelborroy
Alfresco Employee

Re: SDK 3 - delete document

Now the operation is working.

Current user need WRITE permissions on the file to remove it or you should execute your Web Script as "admin": https://angelborroy.wordpress.com/2015/07/24/alfresco-run-as-system-admin-user-without-credentials/

Hyland Developer Evangelist