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

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

book

Article ID: 12271

calendar_today

Updated On:

Products

CA Identity Manager CA Identity Governance CA Identity Portal

Issue/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.



How to add values to a dynamic drop down list ?

Environment

Identity Suite 12.6 SP7Identity Portal 1.6.2

Resolution

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