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

  • Thanks Gopikrishnan, I will test it

    //Mikael

Reply Children
No Data