10-28-2019 08:20 AM
Hello,
We have group "Warehouse" and user who is a Warehouse Manager. Is it possible for Manager to see all tasks currently assigned to Warehouse group?
It would be also nice if Manger could see those tasks and could change assigned user
Situation 1:
there is a user "xyz" who belongs to "Warehouse" group. All processes are assigned to him directly. He goes on vacation. Now manager has to assign his tasks to another user.
Situation 2:
There is a user "xyz", he belongs to "Warehouse" group and he is lazy so he has a lot of not done tasks. Is it possible for Manager to see that?
Is there any solution in Alfresco for those situations?
11-22-2019 07:29 AM
Investigate the following folder in Share source code:
site-webscripts\org\alfresco\components\workflow
There are few places of interest \filters subfolder, workflow-list.get.config.xml, task-list.get.config.xml.
As you can see all filters are nothing but web-scripts that prepare model for UI. Therefore to include or exclude some filter in the model you'll have to modify corresponding JS controller. I.e. I add new filter in all.get.config.xml:
<config>
<filters>
<filter id="workflows" data="active" label="link.workflows.active"/>
<filter id="workflows" data="completed" label="link.workflows.completed"/>
<filter id="workflows" data="all" label="link.workflows.all"/>
</filters>
</config>
Then modify JS controller all.get.js:
<import resource="classpath:alfresco/site-webscripts/org/alfresco/components/workflow/filter/filter.lib.js">
model.filters = [];
var filters = getFilters();
for each(var filter in filters) {
if (filter.data == "all") {
if (user.isAdmin) {
model.filters.push(filter);
}
} else {
model.filters.push(filter);
}
}
Thus, my new "all" filter will get into the model and appear on the UI only if currently logged in user is an admin.
Here "user" is one of the root JS objects in Surf.
As a last step modify workflow-list.get.config.xml, task-list.get.config.xml. Add
<filter id="workflows" data="all" parameters="all=true"/>
to both files to support conversion of new filter to request parameter.
Oh, and one more thing modify resource bundle all.get.properties - add new property for new filter label:
link.workflows.all=Show all
Thats how I implemented it in Share. Hope I didn't forget anything.
10-28-2019 08:29 AM
As far as I know such functionality is not provided out-of-the box. You'll have to customize Share and Repo parts to make it possible.
11-01-2019 08:15 AM
Well, that's kind of sad. A lot of clients need that functionality.
Has anyone implemented something to solve this problem?
Or do you have any idea how it can be done withtout rewriting half of the Alfresco Share's code?
11-05-2019 07:06 AM
I've done something similar in my 5.1 Community. Actyally there is not so much code to be customized. In my project we have a requirement to make possible for admin to see all workflows and to delete them or cancel (no matter who has initiated it).
I've implemented this by adding custom filter for Share pages 'My Workflows' and 'My Tasks'. Those custom filters are available only to admin. Filter makes a request to Repo with a custom flag "show all".
On Repo side I customized few webscripts (like WorkflowInstancesGet and TaskInstancesGet) and WorkflowServiceImpl to implement logic of data retrieval.
Hope this helps you on your path of customization.
11-22-2019 06:06 AM
Thank you, that looks very promissing, I will try to implement something similar.
But how did you manage to create a template with custom filter only for an admin?
11-22-2019 07:29 AM
Investigate the following folder in Share source code:
site-webscripts\org\alfresco\components\workflow
There are few places of interest \filters subfolder, workflow-list.get.config.xml, task-list.get.config.xml.
As you can see all filters are nothing but web-scripts that prepare model for UI. Therefore to include or exclude some filter in the model you'll have to modify corresponding JS controller. I.e. I add new filter in all.get.config.xml:
<config>
<filters>
<filter id="workflows" data="active" label="link.workflows.active"/>
<filter id="workflows" data="completed" label="link.workflows.completed"/>
<filter id="workflows" data="all" label="link.workflows.all"/>
</filters>
</config>
Then modify JS controller all.get.js:
<import resource="classpath:alfresco/site-webscripts/org/alfresco/components/workflow/filter/filter.lib.js">
model.filters = [];
var filters = getFilters();
for each(var filter in filters) {
if (filter.data == "all") {
if (user.isAdmin) {
model.filters.push(filter);
}
} else {
model.filters.push(filter);
}
}
Thus, my new "all" filter will get into the model and appear on the UI only if currently logged in user is an admin.
Here "user" is one of the root JS objects in Surf.
As a last step modify workflow-list.get.config.xml, task-list.get.config.xml. Add
<filter id="workflows" data="all" parameters="all=true"/>
to both files to support conversion of new filter to request parameter.
Oh, and one more thing modify resource bundle all.get.properties - add new property for new filter label:
link.workflows.all=Show all
Thats how I implemented it in Share. Hope I didn't forget anything.
12-05-2019 01:48 AM
Wow, thank you very much for such a detailed instructions!! You rock!
Explore our Alfresco products with the links below. Use labels to filter content by product module.