cancel
Showing results for 
Search instead for 
Did you mean: 

Strange JavaScript API behavior

simon
Champ in-the-making
Champ in-the-making
Alfresco,

I'm testing the new JavaScript API features in 1.3 and they look nice. The default simple Backup script works fine. I changed line 14 from copy.name = "backup of" + copy.name; to:
copy.name = copy.name; 
This still works, no problems here but it seems like a totally useless line, it assigns the the variable to itself. So I removed the line and tested this again… but ran into the following error:
An error occurred

Failed to update category due to system error: Transaction didn't commit: Failed to execute script 'workspace://SpacesStore/f900e25e-0a69-11db-b76c-410603f2342f': Wrapped java.lang.NullPointerException (AlfrescoScript#14)
It works again when I put the "copy.name" line back in place. Why is this?

I'm still on Alfresco 1.3 preview, if this is a bug it could be fixed in 1.3, is it?

Thanks!
2 REPLIES 2

kevinr
Star Contributor
Star Contributor
Yes this was a problem with the save() API call not initiasing properties of a node if you hadn't accessed them yet. This is fixed in 1.3 final.

Thanks,

Kevin

simon
Champ in-the-making
Champ in-the-making
Thanks Kevin!

That's why it's called a "preview" I suppose.  Smiley Very Happy