As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
String currentUsername = authenticationService.getCurrentUserName();
var currentUsername = person.properties.userName;
<property name="authenticationService"> <ref bean="authenticationService"/> </property>
Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'authenticationService' of bean class [org.alfresco.repo.jscript.ScriptBehaviour]: Bean property 'authenticationService' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1361) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:270) … 40 moreCaused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'authenticationService' of bean class [org.alfresco.repo.jscript.ScriptBehaviour]: Bean property 'authenticationService' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1024) at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:900) at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:76) at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:58) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1358) … 44 more
<bean id="onBeforeDeleteMyFolder" class="org.alfresco.repo.policy.registration.ClassPolicyRegistration" parent="policyRegistration"> <property name="policyName"> <value>{http://www.alfresco.org}beforeDeleteNode</value> </property> <property name="className"> <value>{my.test.com}MyDocument</value> </property> <property name="behaviour"> <bean class="org.alfresco.repo.jscript.ScriptBehaviour" parent="scriptBehaviour"> <property name="location"> <bean class="org.alfresco.repo.jscript.ClasspathScriptLocation"> <constructor-arg> <value>alfresco/extension/scripts/onBeforeDeleteNode.js</value> </constructor-arg> </bean> </property> </bean> </property> </bean>
try { var currentUsername = person.properties.userName; } catch (e) { logger.log ("error: " + e.message); } logger.log("currentUsername: " + currentUsername);
DEBUG [repo.jscript.ScriptLogger] error: "person" is not defined.