Getting properties from content model

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

Getting properties from content model

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
sanjaybandhniya
Intermediate

Re: Getting properties from content model

How you are adding aspect and properties to document?

During upload By default that aspect is not added.

sherrymax1
Partner

Re: Getting properties from content model

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