Search code examples
javascriptxpages

How to read a map in sessionScope from CSJS in Xpages?


Via CSJS would like to read the value in a sessionScope. The sessionScope contains a Hashmap. For example I would like to read the array value that I have stored under key "values".

In Xpages I can call SSJS in a scriptBlock element e.g.:

var keyword_custType = '#{javascript: sessionScope.get("customerType")}';

But that reads the complete sessionScope variable as a string e.g.:

keyword_custType = {default=, values=[Private customer|PRIVATE, Corporate customer|COMPANY, Sole trader|SOLETRADER, Corporate Group|CORPGROUP]}

So here I am only interested in the value under key 'values'.

How can I do that?


Solution

  • Have you tried prototyping?

    var keyword_custType = '#{javascript: sessionScope.get("customerType").get('values')}';

    It should work.