How to change default value of required approve percent on workflow

cancel
Showing results for 
Search instead for 
Did you mean: 
koichinakata
Active Member

How to change default value of required approve percent on workflow

Jump to solution

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 Solution

Accepted Solutions
kalpesh_c2
Senior Member

Re: How to change default value of required approve percent on workflow

Jump to solution

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 solution in original post

2 Replies
kalpesh_c2
Senior Member

Re: How to change default value of required approve percent on workflow

Jump to solution

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
Master

Re: How to change default value of required approve percent on workflow

Jump to solution

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.