Restrict Workflow path to one Identity

Hi,

In my work flow I have a stage with several path's, one of them is called "Fast Track Approve"

How can I set so that path only is valid for the CM /Admin identity?

It would have been nice if Aras had possibilities to set permissions/Identities on path,

But it looks like this must be solved by a method.

So I need a method to check user vs identities and then have the method to be run as a pre-method for that path

Regards//Mikael

Parents
  • Hi Mikael

    You can use below piece of code to achieve this.

    Step 1: Open Workflow of ECO

    Step 2: Click on path "Fast Track Approve"

    Step 3: Add below method as Pre Methods event

    //Method Type : Server Side (C#)

    Innovator inn = getInnovator();
    //Allowed Identities (CM and Adminstrators Identity ID)
    string allowedIdentity = "F6624E9AE5504958A84E4B6A5831298B,2618D6F5A90949BAA7E920D1B04C7EE1";
    string path = this.getProperty("name");
    string userID = inn.getUserID();
    Item alias = inn.newItem("Alias", "get");
    alias.setProperty("source_id", userID);
    alias.setAttribute("select", "related_id(id)");
    alias = alias.apply();
    if (alias.isError()) {
    return alias;
    }
    string aliasId = alias.getProperty("related_id");
    string whereCondition = "[Member].related_id=\'" + aliasId + "\'";
    Item IdentityCheck = inn.newItem("Member", "get");
    IdentityCheck.setAttribute("where", whereCondition);
    IdentityCheck.setAttribute("select", "id");
    IdentityCheck.setProperty("source_id", allowedIdentity);
    IdentityCheck.setPropertyCondition("source_id", "in");
    IdentityCheck = IdentityCheck.apply();
    if (IdentityCheck.isError()) {
    return inn.newError("Only Members of CM and Administrators Identity can select this Path. Please reselect the Path");
    }
    return this;

    Thank You

    Gopikrishnan R

  • Hi,

    Sorry, but didn't work for me

    In the Stage for Fast Track Approve I have two identity groups assigned
    "Group1" with User A and User B

    "Group2" with UserC

    UserA, just a standard user, not CM or Admin,
    UserA claims the stage and when UserA selects  "Fast Track approve",
    It works for him and ECO is forwarded

    It should have according to the method being stopped

    Any idea why UserA was able to forward though fast track approve?

  • Hi Mikael

    I tested your scenario and able to block user from vote. Can you check below case

    1. Is this user member of CM / Administrator identity ?

    2. Is this user member of any identity which is member of CM / Administrator identity ?

    Example : user is member Group A and Group A is member of Administrator

    3. Is the ID configured for CM and Administrator identity correct ?

    4. If so, then can you debug this method and check ?

    if (System.Diagnostics.Debugger.Launch()) System.Diagnostics.Debugger.Break();
    Innovator inn = getInnovator();
    //Allowed Identities (CM and Adminstrators Identity ID)
    string allowedIdentity = "F6624E9AE5504958A84E4B6A5831298B,2618D6F5A90949BAA7E920D1B04C7EE1";
    string userID = inn.getUserID();
    Item alias = inn.newItem("Alias", "get");
    alias.setProperty("source_id", userID);
    alias.setAttribute("select", "related_id(id)");
    alias = alias.apply();
    if (alias.isError()) {
    return alias;
    }
    string aliasId = alias.getProperty("related_id");
    string whereCondition = "[Member].related_id=\'" + aliasId + "\'";
    Item IdentityCheck = inn.newItem("Member", "get");
    IdentityCheck.setAttribute("where", whereCondition);
    IdentityCheck.setAttribute("select", "id");
    IdentityCheck.setProperty("source_id", allowedIdentity);
    IdentityCheck.setPropertyCondition("source_id", "in");
    IdentityCheck = IdentityCheck.apply();
    if (IdentityCheck.isError()) {
    return inn.newError("Only Members of CM and Administrators Identity can select this Path. Please reselect the Path");
    }
    return this;

  • Hi Gopikrishnan,

    Still not working for the specific stage, in my case this stage is dynamically assigned, so  on create ECO user selects from a drop down list the Groups (identities) to be assigned, then a method checks that and set these identities as assigned (this assign method works really good). 

    However, if I on another stage add a "fast track approve", have assignee's directly in that stage (no method to add them), then your code blocks the user to go that path if not correct identity

    So your code works, it is somehow related to the dynamically assigned identities.

    My workflow and Dynamically assigned Stage when it has become activated looks like this


    //Mikael

  • Hi again,

    There must be some issue related to the voting weights

    In my previous test where I had direct assigned identities with 100% voting weight each,
    your method worked as desired

    But when I changed it to have 75 for one assignee (not CM or admin related) and 25 for the other, then the user with 75 could do the fast track approve without blocking him for doing that

  • To test voting weight theory, I now tested to update my automatic assign method so the no-admin identity group got 100% in voting weight instead of 75

    Then your method works perfectly

    So it is related to voting weight

    //Mikael

Reply
  • To test voting weight theory, I now tested to update my automatic assign method so the no-admin identity group got 100% in voting weight instead of 75

    Then your method works perfectly

    So it is related to voting weight

    //Mikael

Children
  • If you want to have different voting weight and different user group, you can use below method but on Manufsite Prod Mgmt Review activity - Under server events add this method with event "On Vote".

    Innovator inn = getInnovator();
    //Allowed Identities (CM and Adminstrators Identity ID)
    string allowedIdentity = "F6624E9AE5504958A84E4B6A5831298B,2618D6F5A90949BAA7E920D1B04C7EE1";
    string path = this.getProperty("Path");
    if (path == "Fast Track Approve")
    {
    string userID = inn.getUserID();
    Item alias = inn.newItem("Alias", "get");
    alias.setProperty("source_id", userID);
    alias.setAttribute("select", "related_id(id)");
    alias = alias.apply();
    if (alias.isError()) {
    return alias;
    }
    string aliasId = alias.getProperty("related_id");
    string whereCondition = "[Member].related_id=\'" + aliasId + "\'";
    Item IdentityCheck = inn.newItem("Member", "get");
    IdentityCheck.setAttribute("where", whereCondition);
    IdentityCheck.setAttribute("select", "id");
    IdentityCheck.setProperty("source_id", allowedIdentity);
    IdentityCheck.setPropertyCondition("source_id", "in");
    IdentityCheck = IdentityCheck.apply();
    if (IdentityCheck.isError()) {
    return inn.newError("Only Members of CM and Administrators Identity can select this Path. Please reselect the Path");
    }
    }
    return this;

    Thank You

    Gopikrishnan R

  • Works Perfectly!!

    Thanks a lot!!

    Have a nice weekend

    Regards//Mikael

  • Glad to hear. 

    Thanks

    Gopikrishnan R