11-10-2023 05:42 AM
Hi,
I was wondering how can I get the values of the properties I've created on a custom aspect from a JS script that will be executed by a rule.
So, for example, I have the mc:refinterna aspect which has three properties: ambito, ano and ultimonumero. I've added this aspect to a space and I want to retrieve the three properties from a script and change the name of the document I'm uploading based on those properties.
Here is my script:
ambito = space.properties["refinterna:ambito]; ano = space.properties["refinterna:ano]; ultimonumero = space.properties["refinterna:ultimonumero]; document.name = ambito + "_" + ano + "_" + ultimonumero + ".pdf"; document.save()
When I upload a document it is saved as null_null_null.pdf, so clearly I'm not referencing the properties correctly.
Can anyone please help me with this?
Regards,
Pedro
11-10-2023 10:55 PM
How you are adding aspect and properties to document?
During upload By default that aspect is not added.
11-11-2023 12:25 PM
Try with :
ambito = space.properties["refinterna:ambito"]; ano = space.properties["refinterna:ano"]; ultimonumero = space.properties["refinterna:ultimonumero"]; document.name = ambito + "_" + ano + "_" + ultimonumero + ".pdf"; document.save()
Explore our Alfresco products with the links below. Use labels to filter content by product module.