Symantec IGA

Expand all | Collapse all

How to Build A Dynamic Screen Drop Down with SQL Table Data in IDM

Jump to Best Answer
  • 1.  How to Build A Dynamic Screen Drop Down with SQL Table Data in IDM

    Broadcom Employee
    Posted 10-02-2017 05:14 AM

    Good morning

     

    I have gone through some of the articles available, and can't seem to find a definitive way of populating a Screen Drop Down field with a pre-populated list.

     

    I have a view of the HR system's table with user data, from this, I want to select a distinct set of values to present on a screen for requesting additional access. The task is driven by three fields, Cost Centre, Cost Centre Manager and the Role.

     

    The data needs to be available at the start of the Task.

     

    Regards

    Muzi Lubisi



  • 2.  Re: How to Build A Dynamic Screen Drop Down with SQL Table Data in IDM

    Broadcom Employee
    Posted 10-03-2017 05:49 AM

    Writing the business logic in 'getOptions()' JS function of dropdown should help.

     

    Regards,

    Sumeet

     



  • 3.  Re: How to Build A Dynamic Screen Drop Down with SQL Table Data in IDM
    Best Answer

    Posted 10-03-2017 09:21 AM

    To elaborate on what Sumeet said, you can select JavaScript from the "source of selection options", as javascript it the only one capable of querying an SQL DB. From there you'll have to write custom code to query your SQL table and populate the dropdown box from there. 

     

    There is no default out of the box way to use SQL data in a screen dropdown. 



  • 4.  Re: How to Build A Dynamic Screen Drop Down with SQL Table Data in IDM

    Broadcom Employee
    Posted 10-03-2017 05:45 PM

    I would like to add to what Sumeet and Jennifer suggested. It would it make it much more simpler for you.

     

    Write a UI type PX that runs on "Set Subject" and make SQL call. Store the results in a physical or logical attribute |attr1|. Read this attribute |attr1| in your drop-down attribute using "JavaScript" under "Source of selection options" as shown by Jennifer in screenshot earlier. Here is sample getOptions() JavaScript you can use to load values from Datasase effectively. 

     

    function getOptions(FieldContext){

     

    var roles = FieldContext.getFieldValue("|attr1|");

     

    return roles;

     

    }

     

    P.S.: Please make sure |attr1| contains pipe delimited string of options.

     

    This way PX will do the heavy lifting and you won't have to worry about database connection handling and calling SQL from JavaScript. I hope it helps.



  • 5.  Re: How to Build A Dynamic Screen Drop Down with SQL Table Data in IDM

    Broadcom Employee
    Posted 10-10-2017 04:09 AM

    Hi Everyone.

     

    Thank you for all the assistance. I was able to deploy the field as required.

     

    As you decribed described, I needed a Screen Logical Attribute to write to; I used PolicyX to get the data, one additional step is transforming the data by replacing the caret ('^') with a pipe ('|') for the JavaScript to present the data properly.  I then pass the piped string to the Screen Logical Attribut, which is displayed using JavaScript.

     

    Regards

    Muzi



  • 6.  Re: How to Build A Dynamic Screen Drop Down with SQL Table Data in IDM

    Broadcom Employee
    Posted 10-10-2017 10:49 AM

    I am glad it worked for you.