js file unable to fetch values from properties files

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 Solved
0 1 73
1 ACCEPTED 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.

View solution in original post

1 REPLY 1

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.