Can I generate a value based on user input

We have a need for an admin to input an 8-digit code into a virtual attribute named "Challenge" on a user form, run that code through a "generator.exe" on the Active Roles server, then display it in another virtual attribute named "Response".  At this point, when i hit "Save", I can run whatever a user types into the Challenge attribute through the generator.exe and return the "response" code in an error on the red banner or even a policy compliance error near the attribute, but I would love to refresh the form within the Response code in the Response virtual attribute on the form. If there is a way to get the value the user typed into the Challenge attribute and process it without hitting Save and having to re-open the user to see the written response code in the Response virtual attribute, that is what I'm looking for.

I've tried various ways in onGetEffectivePolicy and onCheckPropertyValues and onPreModify, but I can only seem to get the code to display in the WebUI if I write the response code to the Response virtual attribute then re-open the user and see it, or if i throw an error with it.  Anyone have any ideas?

Parents
  • Hopefully this code will help point you in the right direction. It will create a generate button next to the Response VA, much like the button next to samAccountName when generation rules are in place. Adjust the attribute names of the two variables at the top of the script, and obviously run the necessary code within the function to generate the proper Response value.

    function onGetEffectivePolicy($Request)
    {
       if ($Request.Class -ne "user") {return}
    
       # Get the value from this attribute that has been entered on the AR interface
       $Value = $Request.Get('edsvaChallenge')
    
       # Set the attribute name affected by this policy script
       $strAttrName = "edsvaResponse"
       
       # Call the function to generate the response value   
       $ResponseValue = GenerateValue $Value
       
       # Set policies on the attribute that will display the calculated/computed value and display the lightning bolt button next to it
       $Request.SetEffectivePolicyInfo($strAttrName, $Constants.EDS_EPI_UI_DISPLAY_NOTE, "Computed value based on Challenge VA entry")
       $Request.SetEffectivePolicyInfo($strAttrName, $Constants.EDS_EPI_UI_SERVER_SIDE_GENERATED, $ResponseValue)
       $Request.SetEffectivePolicyInfo($strAttrName, $Constants.EDS_EPI_UI_GENERATED_VALUE, $ResponseValue)
    }
    
    function GenerateValue ($Value)
    {
       # Run code here that takes the inputted value from the AR interface
    
       # Example returning values when lightning bolt button is clicked
       if ($Value -eq "12345678")
       {
          return "ABCD"
       }
       else
       {
          # Return something else
          return "Please enter 12345678"
       }
    }

Reply Children
No Data