How to get record type of document in rule script?

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

How to get record type of document in rule script?

Hi, I am using Alfresco community version: 5.2.0 (r135134-b14)

I have document of my own type.({http://www.alfresco.com/model/mymodel/mytype}mytype) with name "My Document Type"

I want to get name of record type in rule script. How can I get it?

var TYPE = document.type; returns  TYPE {http://www.alfresco.com/model/mymodel/mytype}mytype

In Java I can get name of record using dictionaryService

TypeDefinition type = dictionaryService.getType(QName.createQName("{http://www.alfresco.com/model/mymodel/mytype}mytype"));

I cannot find any possibility in Script API to achieve this.

2 Replies
douglascrp
Advanced II

Re: How to get record type of document in rule script?

Have you tried to use this? 

document.typeShort;

afaust
Master

Re: How to get record type of document in rule script?

What he means is to access the dictionary definition of the type. There is no Script API for this. In previous projects I created my own thin wrapper whenever necessary, or used the Java interopability features to access the DictionaryService from JavaScript (which is cumbersome and not recommended for regular development, but for JavaScript Console use cases).