cancel
Showing results for 
Search instead for 
Did you mean: 

Getting properties from content model

pmeireles
Champ in-the-making
Champ in-the-making

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

2 REPLIES 2

sanjaybandhniya
Elite Collaborator
Elite Collaborator

How you are adding aspect and properties to document?

During upload By default that aspect is not added.

sherrymax1
Champ in-the-making
Champ in-the-making

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