Topic
  • 5 replies
  • Latest Post - ‏2013-09-11T06:54:05Z by wpc_guy
SystemAdmin
SystemAdmin
648 Posts

Pinned topic How to get Initiator's Role, user and email ID in workflow step ?

‏2013-04-05T05:17:45Z |
Hi,

I have a workflow having 5 steps.Suppose the sequence of the steps is A-B-C-D-E. A or B can initiate the request, if A initiate the request then the next step will be B, If B initiate the request then the next step will be C. How can we know that who has initiated the request in workflow steps( C,D,E)?
  • KaranBal
    KaranBal
    108 Posts

    Re: How to get Initiator's Role, user and email ID in workflow step ?

    ‏2013-05-15T21:27:58Z  

    2 cases come to mind:
    1. If you are the admin and you want a set-up such that you can get that information(not the business user), then you can use SQLs from the "DB Admin" screen under "System Administrator" to do so. The CEH table contains the history of an item in the collaboration area and one of the columns is CEH_USER_NAME. Here is a sample:
    select distinct(CEH_USER_NAME) from ceh where CEH_CA_NAME='Name of the Collaboration Area' and CEH_STEP_PATH='Name of the Step' and
    CEH_ENTRY_KEY='Primary Key of the item';

     

    2. If you want business users to be able to retrieve it, then we need to get creative. A few alternatives are:

    2.1. You can define workflow steps to send e-mails when an item enters the workflow step. This way you can have an audit trail.

    2.2. Create 3 attributes in the spec of the item say XA, XB, and XC. Each workflow has an in and out script. Inside the in script for workflow step A, you can have code which populated XA with the information of the user, within the in script of workflow step B, you can have code to populate XB and so on. This way when looking at the item in step D, the attribute values will show who moved it to A, B, C, and so on. These scripts are defined in the workflow step definition page, "Data Model Manager" > "Workflows" > "Workflow Console" > open the workflow > click on the step name.

    2.3. You can also write this to a file and upload it to the docstore for later review.

  • Rocky_01
    Rocky_01
    32 Posts

    Re: How to get Initiator's Role, user and email ID in workflow step ?

    ‏2013-09-05T11:07:50Z  
    • KaranBal
    • ‏2013-05-15T21:27:58Z

    2 cases come to mind:
    1. If you are the admin and you want a set-up such that you can get that information(not the business user), then you can use SQLs from the "DB Admin" screen under "System Administrator" to do so. The CEH table contains the history of an item in the collaboration area and one of the columns is CEH_USER_NAME. Here is a sample:
    select distinct(CEH_USER_NAME) from ceh where CEH_CA_NAME='Name of the Collaboration Area' and CEH_STEP_PATH='Name of the Step' and
    CEH_ENTRY_KEY='Primary Key of the item';

     

    2. If you want business users to be able to retrieve it, then we need to get creative. A few alternatives are:

    2.1. You can define workflow steps to send e-mails when an item enters the workflow step. This way you can have an audit trail.

    2.2. Create 3 attributes in the spec of the item say XA, XB, and XC. Each workflow has an in and out script. Inside the in script for workflow step A, you can have code which populated XA with the information of the user, within the in script of workflow step B, you can have code to populate XB and so on. This way when looking at the item in step D, the attribute values will show who moved it to A, B, C, and so on. These scripts are defined in the workflow step definition page, "Data Model Manager" > "Workflows" > "Workflow Console" > open the workflow > click on the step name.

    2.3. You can also write this to a file and upload it to the docstore for later review.

    Hi Karan,

    1st case that you have mentioned is quite amazing. I really don't have such a good idea of the internal table schema of the PIM events.

    In my implementation, i am also facing a similar kind of problem and i hope 1st case will help me to resolve that. But here i have one doubt, Can this SQL query be retrived using any script APIs?

    Thanks,

    Pritam

  • KaranBal
    KaranBal
    108 Posts

    Re: How to get Initiator's Role, user and email ID in workflow step ?

    ‏2013-09-05T16:23:08Z  
    • Rocky_01
    • ‏2013-09-05T11:07:50Z

    Hi Karan,

    1st case that you have mentioned is quite amazing. I really don't have such a good idea of the internal table schema of the PIM events.

    In my implementation, i am also facing a similar kind of problem and i hope 1st case will help me to resolve that. But here i have one doubt, Can this SQL query be retrived using any script APIs?

    Thanks,

    Pritam

    I have never run SQLs via JAVA APIs and I don't think this can be done. But please review the information center to confirm because if a method exists, it should be documented in the IC. I know we can run script functions via JAVA API but not SQLs.

  • Alexander_Zinovin
    Alexander_Zinovin
    75 Posts

    Re: How to get Initiator's Role, user and email ID in workflow step ?

    ‏2013-09-10T05:39:01Z  
    • Rocky_01
    • ‏2013-09-05T11:07:50Z

    Hi Karan,

    1st case that you have mentioned is quite amazing. I really don't have such a good idea of the internal table schema of the PIM events.

    In my implementation, i am also facing a similar kind of problem and i hope 1st case will help me to resolve that. But here i have one doubt, Can this SQL query be retrived using any script APIs?

    Thanks,

    Pritam

    You can work with DB via script API. See the example below.

    var dbContext = getWPCDBContext();
    var dbConnection = dbContext.getWPCDBConnection();
    var ctrId = ctr.getContainerId();

    var query = "select OBG_NAME from obg, ctr where CTR_TYPE='CATEGORY_TREE' and CTR_ID="+ctrId+" and OBG_ID=CTR_OBJECT_GROUP_ID";

    var resultSet = dbConnection.executeQuery(query);
    var obgName = "";
    if(resultSet.next())
    {
    obgName = resultSet.getColumnAt(1);
    }
    dbContext.releaseWPCDBConnection(dbConnection);

     

  • wpc_guy
    wpc_guy
    40 Posts

    Re: How to get Initiator's Role, user and email ID in workflow step ?

    ‏2013-09-11T06:54:05Z  

    You can work with DB via script API. See the example below.

    var dbContext = getWPCDBContext();
    var dbConnection = dbContext.getWPCDBConnection();
    var ctrId = ctr.getContainerId();

    var query = "select OBG_NAME from obg, ctr where CTR_TYPE='CATEGORY_TREE' and CTR_ID="+ctrId+" and OBG_ID=CTR_OBJECT_GROUP_ID";

    var resultSet = dbConnection.executeQuery(query);
    var obgName = "";
    if(resultSet.next())
    {
    obgName = resultSet.getColumnAt(1);
    }
    dbContext.releaseWPCDBConnection(dbConnection);

     

    Hi,

      You can run SQL Queries from JAVAAPI using the below :

     

    String SQL = "select  count(*) from cmp";

    String[ ] [ ] res = ThreadResource.getResourceForCurrentThread().getDBContext().executequery(SQL);

    String sqlresult = res[0][0];

    System.out.println(" sqlresult = "+sqlresult);

     

     

    Regards,

    Jaheer