search cancel

JS not working for Source of selection options for screen dropdown

book

Article ID: 253860

calendar_today

Updated On:

Products

CA Identity Manager

Issue/Introduction

I am attempting to populate a dropdown with options that are sourced from basic JS.  The JS is as follows:

function getOptions(FieldContext){    var output =[];    var object = {firstName:"John", lastName:"Doe", age:50, eyeColor:"blue"};    var array = ["first","second","third","fourth"];    array.forEach((k,v) => {output.push("iterated array");});    Object.entries(object).forEach(([k,v],i) => {output.push("iterated object");});    return output.join("|");}

This should return eight options, the first four "iterated array" and the second four "iterated object".  Instead, it returns nothing.  Testing (by commenting out the "object" line) seems to suggest that there's something wrong with the JS intepreter's Object.entries() function? When that line right before the "return" is commented out, IDM correctly returns four options, all "iterated array", for this function.

As you can see below, Chrome's JS VM has no problem returning the expected response:

Environment

Release : 14.4

Resolution

We are using 3rd party- Rhino 1.7.12- binary to execute the javascript on java platform, which does not support Object.entries.

You can review the rhino documentation for more details on what is supported by the 1.7.12 version of Rhino 
http://mozilla.github.io/rhino/compat/engines.html#ES2015-optimisation

Additional Information

The newer 1.7.14 version of Rhino does support Object.entries.  Our Engineering team is working with Development towards updating this in a future release.  

Attachments