How do I add values to a dynamic drop down list ?

Document ID : KB000012271
Last Modified Date : 14/02/2018
Show Technical Document Details
Introduction:

Identity Portal forms show the data retrieved from Identity Manager. 

In some cases there is a need to add to those values.

This Knowledge Article explains how to achieve this.

Question:

How to add values to a dynamic drop down list ?

Environment:
Identity Suite 12.6 SP7Identity Portal 1.6.2
Answer:

In the initialization code of the attribute, add the following code:

var userID = api.getRequester().userData['UserId'][0];

return api.server(['getOffice', userID]).then(

function(success) {

     var arr = $.parseJSON(success.returnValue);

     for (i = 0; i < arr.length; i++) {

          prop.options.push({"name":arr[i].officeName,"value":arr[i].officeValue});

     }

}, function(error) {

     prop.errors = ['Error in initialization handler'];

});

The above code gets the values of the drop down from Identity Manager for the 'office' attribute and pushes them into the drop down in Identity Portal.

You can add more values by pushing them into the prop object.

The return statement ensures the form will wait for the call to return before populating all the other props.

Additional Information:

None