Hi ,
I have a properties file under resource section with the below line of property:
userName1=pavan
and I have a JS file with below line of code:
var user=context.getVariable("userName1");
print(user);
"user" is actually getting null and it is not fetching value from properties.
Help me why this is happening and How can I fetch the values into JS from properties file.
and I have also tried adding as <Properties> in JS policy, but still "null" is populating.
Appreciate the support.
Thanks
Solved! Go to Solution.
Checkout this doc, this details how to define property-sets and access the named values. To access the property value defined in property set the property_set_name should prefix "propertyset.<property_set_name>"
context.getVariable('propertyset.property_set_name.property_name);
So for your example, it should be
var user=context.getVariable("propertyset.property_set_name.userName1");
Thanks.
Checkout this doc, this details how to define property-sets and access the named values. To access the property value defined in property set the property_set_name should prefix "propertyset.<property_set_name>"
context.getVariable('propertyset.property_set_name.property_name);
So for your example, it should be
var user=context.getVariable("propertyset.property_set_name.userName1");
Thanks.