Question

Referencing a Dynamic System Settings variable from javascript

I have a javascript function that I call from an action set on a button. I have a variable in that javascript that I want to have set to a dynamic system setting variable.

var url = '<%= com.pegarules.generated.pega_rules_utilities.getDataSystemSetting("rulesetXX","ServiceUrl")%>'; 

This doesn't work. I just get back that same string not the DSS variable. What's the proper syntax for doing this?

***Edited by Moderator Marissa to update platform capability tags****

Correct Answer
November 25, 2019 - 12:37pm

I can think of a couple of alternatives to set the DSS value to JS variable.

1. Call an activity from within the JS function using AJAX and get the DSS value and assign it to the variable.

2. Prior to calling the JS on click of the button, add a 'Run DT' or 'Run Activity' action and set the value of DSS to a property and pass the property value as a param to the JS function.

Comments

Keep up to date on this post and subscribe to comments

November 25, 2019 - 12:37pm

I can think of a couple of alternatives to set the DSS value to JS variable.

1. Call an activity from within the JS function using AJAX and get the DSS value and assign it to the variable.

2. Prior to calling the JS on click of the button, add a 'Run DT' or 'Run Activity' action and set the value of DSS to a property and pass the property value as a param to the JS function.

November 25, 2019 - 2:39pm
Response to PraneethPurighalla

I used your second option with a data transform and passing the parameter. It worked like a charm. Thanks!