Layer7 Identity Management

Expand all | Collapse all

Task Session ID in PX Policy

Jump to Best Answer
  • 1.  Task Session ID in PX Policy

    Posted 11-01-2016 04:42 PM

    This is an issue I had and I've seen a few other posts about, so I thought I'd toss in the solution in case it is useful to anyone else.

     

    So the problem: being able to access the current task session ID in a PX policy.

     

    There are a number of reasons you might need this - we use it for auditing in an external db, as well as putting it in emails so we can track the exact task the email came from and thus find it easily in the VST.

     

    PX Policy (at least our version 12.6.6 - not sure about later) has no way of pulling this task info. However you _can_ get that information with a BLTH. So my solution was to place a JavaScript BLTH on the tasks that I need the task session ID for to insert the id as a custom 'task session attribute'. Then we leverage the get Task Session Attribute option in the Data elements of a PX policy to get it.

     

    Here's the JavaScript code. It creates two custom Task Session Attributes, one for the task session ID, and one for the creation time of the task session.

     

    ---

     

    function handleStart(blthContext, errorMsg) {

    try {
        var taskID = blthContext.getSessionId();
        var now = blthContext.getSessionCreateTime();
        var df = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

        blthContext.setSessionAttribute("taskID",taskID);
        blthContext.setSessionAttribute("date",df.format(now));

    }
    catch (exception) {
        errorMsg.reference = "Cannot set Task ID or Create DateTime";
        return false;
    }
    return true;
    }

     

    ---

     

    Then in the PX policy, I create a data element like this:



  • 2.  Re: Task Session ID in PX Policy
    Best Answer

    Posted 11-02-2016 12:57 AM

    This is indeed helpful note. I would like to add one more point. I think since 12.6 SP6 user friendly task number is introduced and available in PX. Task session ID is very long string and sometimes not useful. You can use this Task Number for notification purpose or auditing. You can search tasks by this task number in View Submitted Tasks. It is directly linked to Task Session ID. 



  • 3.  Re: Task Session ID in PX Policy

    Posted 05-11-2018 02:02 PM

    Scott,

     

    Excellent work.   I have put in an enhancement request as well.

     

    I have added on to your efforts in this note.

     

    Javascript BLTH to add the IM TaskID to document the IM Business Logic for Policy Xpress 

     

    Cheers,

     

    Alan



  • 4.  Re: Task Session ID in PX Policy

    Posted 06-26-2018 12:52 PM

    This is simple and elegant.