cancel
Showing results for 
Search instead for 
Did you mean: 

How to check the workflow initiator is a member of a specific group?

miraclesuki
Champ in-the-making
Champ in-the-making
Hi,

The objective was to find out the workflow starter does the member of a specific group.
First, I need to get the member list inside a group.

A simple javascript that get the list of member inside a group, but it failed:


<scriptTask id="scripttask1" name="Script Task" scriptFormat="javascript" activiti:autoStoreVariables="true">
      <script>var node = people.getGroup("GROUP_Marketing");

    if(node){
        logger.log("Marketing member list:        " + people.getMembers(node));        
    }</script>
    </scriptTask>


And I get this error:

SEVERE: Error while closing command context
org.activiti.engine.ActivitiException: problem evaluating script: sun.org.mozilla.javascript.EcmaError: ReferenceError: "people" is not defined. (<Unknown source>#1) in <Unknown source> at line number 1


So, may I know the correct method to determine the workflow starter does exist the member of a specific group?
Thanks all for your kindly help.

-Mandy
4 REPLIES 4

miraclesuki
Champ in-the-making
Champ in-the-making
Could anyone can help to give some advise on it? Many Thanks!

romschn
Star Collaborator
Star Collaborator
Just understood from your post that, you want to find out whether the workflow initiator is part of some group or not. However, I did not completely understand your use case. What exactly you want to achieve? Is it something that if the initiator does not belong to the specified group then he should not be able to start the workflow? If that is the case then, In my opinion, you should make a customization to hide the workflow option on start workflow page for all other users except your specific group.

Hope this helps.

miraclesuki
Champ in-the-making
Champ in-the-making
Thanks for your kindly reply.
I'd like to state more detail. I want to check the workflow initiator whether is a member of a specific group to run a specific flow in the bpmn diagram by the script task and exclusive gateway. Otherwise, i need to create separated workflow diagram to specify the different groups. And this way looks quite dummy.

And there is another way that you could say, I can create different separated workflows diagram by controlling the display of the start workflow menu that each specific group can only see their own workflow in the list. But I have no any idea to do this, thanks!

-Mandy

Hi Mandy,

I tried your scenario using a service task and it worked well. I have always had issues with script tasks on workflow start-ups.
You do not need to double your work by creating multiple instance of one business process.