AnsweredAssumed Answered

Webscript is not getting executed

Question asked by udayakumar_p on Feb 7, 2018
Latest reply on Feb 8, 2018 by krutik.jayswal

We have defined a rule which executes the following javascript.

 

if(document.properties["common:contentStatus"] != null ) {
document.properties["common:createdBy"] = person.properties.userName;
document.properties["common:createdDate"] = date;
document.save();
}

 

The above script is used to set the created by user and creation date to a common property defined in the model. This scripts needs to be executed whenever a content is created using alfresco share.

 

The script does not get called when we are trying to create a content from a custom model which has a hidden.ftl field defined in share-config.xml.

Below is a sample configuration.

 

<appearance>

<field id="cm:content">
<control template="/org/alfresco/components/form/controls/hidden.ftl">
<control-param name="contextProperty">cm:content</control-param>
</control>
</field>

</appearance>

 

When this field is there, the webscript does not get called. Due to this the created by and created date property is unset. When this field is removed from share-config definition, the webscript gets executed. But we want this field definition.

 

1. Why is the javascript code not getting executed but gets executed when the field definition is removed?

2. Is the above field configuration correct?

 

Kindly assist.

Outcomes