RE: assign workflow to different organisation

ALEX KEIL, modified 6 Years ago. New Member Posts: 23 Join Date: 5/23/19 Recent Posts
Hello all. I've been trying to do this for a while now, I have a workflow foe a custom entity, during the workflow process we would like to assign the task to an Organisation role but across different organisations.
for example the first step would be assigned to an organisational role in Organisation A, it would then be assigned to an organisational  role in Organisation B and so on.I found a few articles, the most promising was https://www.xtivia.com/liferay-dxp-workflow/ but sadly I've tried this and it doesn't seem to work, or likely I'm doing it wrong lol. Has anyone used this method? I put the code into a workflow action (minus the first part about an Entry, in my code i set the group ID of the custom entity on creation).
I can get the workflow task assigned to the correct role in the database, but it does not show up when you sign in as the user and check My Workflow Tasks (assigned to me or to my roles). I did manage to get it to work but only for organisational roles in the same organisation as the submitting user. If I try to change the organisation to a different one, notifications and assignments do not work.
We are trying to do this to avoid making a large number of standard roles, as we will likely have many workflows in place. Any insight would be greatly appreciated. 

Thanks in advance 
thumbnail
Olaf Kock, modified 6 Years ago. Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts
ALEX KEIL:

I can get the workflow task assigned to the correct role in the database, but it does not show up when you sign in as the user and check My Workflow Tasks (assigned to me or to my roles).
Important note upfront: DO NOT manually change the database. This is the best way to ensure that you'll be running into problems later, either during day-to-day-operations or during the next upgrade. Start over with a new database to make sure that you'll not run into those issues.
ALEX KEIL:

Hello all. I've been trying to do this for a while now, I have a workflow foe a custom entity, during the workflow process we would like to assign the task to an Organisation role but across different organisations.
...
I haven't tried the mechanism that you link. Just keep in mind: An Organization role is always only assigned in the scope of a particular Organization. You might have this role within one organization, but not within another. Thus, keeping an overview over the intended scope and the right organization quickly becomes messy. Especially when you see that every user might be assigned to any number of organizations, and they'll have implicit membership of the parent organization as well, in case you have a hierarchy.
Content, on the other hand, is always existing within the scope of a group (or simplified, site), that might not overlap with some organizational role granted in another scope. Thus, you'll have to duplicate something: Either the access of your unrelated organization members to the content in question (so that they may see or edit the content they're about to approve or reject in a random scope), or the roles.
Another option is to use scripted assignment and just write a script that finds the correct assignee.
ALEX KEIL, modified 6 Years ago. New Member Posts: 23 Join Date: 5/23/19 Recent Posts
Thanks for the prompt response emoticon sorry to clarify when I said I updated the database I meant from within a script for example using workflowcontextlocalserviceutil (or is this a bad idea also). I get what you mean about scope issues with organisations.. what we were thinking was along those lines however. For example everyone that is a manager of an Organisation would be given that organisatinonal role.. but they would only belong to one organisation.. so when they are assinged a task they only see the task in that organisation. it would save creating a role for managers per organisation. with regard to your last comment, I have scripts that will assign to individual users, that works regardless of organisation but we were really hoping to be able to assign to multiple people in case one was not available, hence wanting to use roles. Correct me if I'm wrong but you can't assign to more than one user can you? it's either a single user or a role? ( in scripted assignments i mean). At the end of the script I include for example:user = null;role = <the role>is it possible to pass a list of users to the 'user' section?
Thanks again for your help it's very appreciated
thumbnail
Amos Fong, modified 6 Years ago. Liferay Legend Posts: 2047 Join Date: 10/7/08 Recent Posts
 Correct me if I'm wrong but you can't assign to more than one user can you?
Yea, you can only assign to a single user or multiple roles.
Does your custom entity have a groupId? Maybe it's a permissioning issue?
ALEX KEIL, modified 6 Years ago. New Member Posts: 23 Join Date: 5/23/19 Recent Posts
yeah it's possible that it's a permissions issue.. I found that I had to create a site for each organisation that needs to be in the workflow, and also have to set workflow on the entity in each organisation too. I will double check permissions, I usually see messages in the logs if permissions are incorrect but it's worth a try emoticonThanks