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 ?
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.
None