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
  • For your use case involving Employee-Department associations and the selection of departments during product ordering in ITShop, you're on the right track with your current approach. To address your concerns:

    1. Using PersonInDepartment.XObjectKey as a DataSource in the parameter set is a reasonable choice to avoid errors. It's often preferable to use fields that are less likely to cause issues.

    2. You can indeed use the "On property changed script" in the Request Property to achieve your goal more logically. This approach can help streamline your workflow. Here's a simplified example of what the script might look like:

      // Assuming you have access to relevant variables and objects
      var selectedDepartment = RequestProperty.XObjectKey; // Retrieve the selected department from the Request Property

      // Now, you can update the PersonWantsOrg.UID_Department field
      PersonWantsOrg.UID_Department = selectedDepartment;

      // Don't forget to save the changes if needed
      PersonWantsOrg.Save();


      Remember to adapt the script according to your specific data structure and business logic. You may need to handle error-checking and validation based on your requirements.

      Since you are using One Identity Manager 9.1 and the HTML5-based Web portal (ApiServer), make sure to refer to the official documentation for any syntax and functionality specifics that might apply to your version.

      If you have any more questions or need further assistance, please feel free to ask.

      Best regards,

      Twin Mark 

      Fort Lauderdale Property Management

Reply
  • For your use case involving Employee-Department associations and the selection of departments during product ordering in ITShop, you're on the right track with your current approach. To address your concerns:

    1. Using PersonInDepartment.XObjectKey as a DataSource in the parameter set is a reasonable choice to avoid errors. It's often preferable to use fields that are less likely to cause issues.

    2. You can indeed use the "On property changed script" in the Request Property to achieve your goal more logically. This approach can help streamline your workflow. Here's a simplified example of what the script might look like:

      // Assuming you have access to relevant variables and objects
      var selectedDepartment = RequestProperty.XObjectKey; // Retrieve the selected department from the Request Property

      // Now, you can update the PersonWantsOrg.UID_Department field
      PersonWantsOrg.UID_Department = selectedDepartment;

      // Don't forget to save the changes if needed
      PersonWantsOrg.Save();


      Remember to adapt the script according to your specific data structure and business logic. You may need to handle error-checking and validation based on your requirements.

      Since you are using One Identity Manager 9.1 and the HTML5-based Web portal (ApiServer), make sure to refer to the official documentation for any syntax and functionality specifics that might apply to your version.

      If you have any more questions or need further assistance, please feel free to ask.

      Best regards,

      Twin Mark 

      Fort Lauderdale Property Management

Children
No Data