cancel
Showing results for 
Search instead for 
Did you mean: 

How to change default value of required approve percent on workflow

koichinakata
Champ on-the-rise
Champ on-the-rise

Hello Experts,

How do I change  default value of required approve percent on workflow in my Alfresco env(5.2 CE)?

I want to set it 1 in workflow creation form.

Regards,

Koichi.

1 ACCEPTED ANSWER

kalpesh_c2
Star Collaborator
Star Collaborator

Hi,

You can change the value of required approve percent by overriding 'percentage-approve.ftl' file, which is located at <ALFRESCO-HOME>\tomcat\webapps\share\WEB-INF\classes\alfresco\site-webscripts\org\alfresco\components\form\controls\ in community edition.

You will find the following code in the file.

(function()
{
new Alfresco.PercentageApprove("${fieldHtmlId}").setOptions(
{
currentValue: <#if field.value?exists>${field.value}<#else>50</#if>,
minValue: <#if field.control.params.minValue?exists>${field.control.params.minValue}<#else>1</#if>,
maxValue: <#if field.control.params.maxValue?exists>${field.control.params.maxValue}<#else>100</#if>
}).setMessages(
${messages}
);
})();

Here, the 'currentValue' is given '50'. You can change it as per your requirement.

NOTE: It is bad practice to make changes in existing files of alfresco. You can override the existing functionality by creating appropriate folder structure within 'shared' folder.

Please let me know if you have any further query.

Thanks,

Kalpesh

ContCentric

View answer in original post

2 REPLIES 2

kalpesh_c2
Star Collaborator
Star Collaborator

Hi,

You can change the value of required approve percent by overriding 'percentage-approve.ftl' file, which is located at <ALFRESCO-HOME>\tomcat\webapps\share\WEB-INF\classes\alfresco\site-webscripts\org\alfresco\components\form\controls\ in community edition.

You will find the following code in the file.

(function()
{
new Alfresco.PercentageApprove("${fieldHtmlId}").setOptions(
{
currentValue: <#if field.value?exists>${field.value}<#else>50</#if>,
minValue: <#if field.control.params.minValue?exists>${field.control.params.minValue}<#else>1</#if>,
maxValue: <#if field.control.params.maxValue?exists>${field.control.params.maxValue}<#else>100</#if>
}).setMessages(
${messages}
);
})();

Here, the 'currentValue' is given '50'. You can change it as per your requirement.

NOTE: It is bad practice to make changes in existing files of alfresco. You can override the existing functionality by creating appropriate folder structure within 'shared' folder.

Please let me know if you have any further query.

Thanks,

Kalpesh

ContCentric

afaust
Legendary Innovator
Legendary Innovator

You don't even have to override this widget. Simply initialise your workflow / task form model to include an explicit default value. This can be done by adding a form filter Java bean on the Repository tier that sets a custom default value in the generated form metadata.