Request Property and data from PersonInDepartment

Hi all,

I am trying to solve the following use case:
An Employee is associated with several Departments through PersonInDepartment. When the Employee is ordering a product from ITShop, they should be able to select one of their Departments in a drop down list. This department should then be saved to PersonWantsOrg for further use (i.e. approval by the correct manager).

Currently I have created a request property with data source PersonInDepartment.XObjectKey and condition UID_Person = '%UserUID%'. I then added code in the OnSaving Script for PersonInDepartment that parses DialogParameterSet, DialogParameter and PersonInDepartment, and populates PersonWantsOrg.UID_Department. This works, but feels like a very cumbersome approach, and i beleive two of the steps could be solved better:

1. I have PersonInDepartment.XObjectKey as DataSource in the parameter set because I get an error message if I try to use PersonInDepartment.UID_Department. In the web-frontend I get "An error occured while processing your request". 
2. I feel that using the "On property changed script" in the Request Property is a more logical approach than using OnSaving script in PersonWantsOrg, but I'm not sure about the syntax here. Is it possible to use this script to populate PersonWantsOrg? Are there any example code that can help me out?

I am using One Identity Manager 9.1 and the new HTML5 based Web portal (ApiServer)

Parents
  • The "On property change" script is used to dynamically determine whether a parameter is read-only or mandatory, for example.

    Example:

    The P2 parameter should be a mandatory field when the P1 parameter has the value Mandatory field. The following script must be stored with the P1 parameter:

    ParameterSet("P2").IsMandatory = (Value IsNot Nothing AndAlso Value.ToString() = "Pflichtfeld")

    But to simplify your use case a little bit, I propose to use to lookup against the Department table, select the UID_Department and in the where-clause use:

    EXISTS (
    		SELECT 1
    		FROM PersonInDepartment
    		WHERE PersonInDepartment.UID_Person = '%UserUID%'
    			AND PersonInDepartment.UID_Department = Department.UID_Department
    		)

Reply
  • The "On property change" script is used to dynamically determine whether a parameter is read-only or mandatory, for example.

    Example:

    The P2 parameter should be a mandatory field when the P1 parameter has the value Mandatory field. The following script must be stored with the P1 parameter:

    ParameterSet("P2").IsMandatory = (Value IsNot Nothing AndAlso Value.ToString() = "Pflichtfeld")

    But to simplify your use case a little bit, I propose to use to lookup against the Department table, select the UID_Department and in the where-clause use:

    EXISTS (
    		SELECT 1
    		FROM PersonInDepartment
    		WHERE PersonInDepartment.UID_Person = '%UserUID%'
    			AND PersonInDepartment.UID_Department = Department.UID_Department
    		)

Children
No Data