Question


PayPal
IN
Last activity: 16 Oct 2018 12:03 EDT
Not able to use tools.getSystemSettings() inside function rule
I want to use tools.getSystemSettings() in my function rule. However am getting the error message that "tools cannot be resolved".
Do we need to import any package before using tools.getSystemSettings() in function rule?.kindly help.
**Moderation Team has archived post**
This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.


Areteans
IN
Hi Ashwin,
Can you try using like below and let us know if it helps,
((PegaAPI)tools).getSystemSettings()
Thanks,
Bala


PayPal
IN
Thanks for the reply Bala.
I tried as above ,but am still getting the same error that "tools cannot be resolved" when try to save function rule.Any other way ?


Sopra Steria AG
CH
Hi,
Try with below syn.
String XYZ = tools.getSystemSettings().getDynamic("Ruleset","SettingName");
Thanks,
Kiran


Pegasystems
US
You may need to pass "tools" in as a parameter to your function. /Eric


isoftstone
CN
Can you offer the operation details about how to pass "tools" as a parameter in our function , Such as how to define, pass this parameter ?
Thanks in advance !


Pegasystems Inc.
IN
can you try this @(Pega-RULES:Utilities).getSystemSetting()


PayPal
IN
I tried.@(Pega-RULES:Utilities) cannot be used inside function rule


Pegasystems
US
>>> I [email protected](Pega-RULES:Utilities) cannot be used inside function rule
The syntax for calling a function from within java is much different than the syntax of calling the function from an activity pre or post condition.
If your goal is to call "@(Pega-RULES:Utilities).getSystemSetting()" from a function rule, then first use that syntax in an activity pre or post condition, and after you successfully save the activity, use "action > java" and search for references to that call to getSystemSetting to see what java syntax got generated, and you can copy that syntax into your function definition.


Capgemini
IN
Replace tools with (PRThread)ThreadContainer.get().getPublicAPI()
-Saikat


Department of Planning and Environment
AU
Use something as below in your function rule
PublicAPI tools = null;
PRThread thisThread = (PRThread)ThreadContainer.get();
if (thisThread != null)
tools = thisThread.getPublicAPI();
else
throw new PRAppRuntimeException("Pega-RULES", 0, "Unable to obtain current thread");
the way to invoke the systems settings will be tools.getSystemSettings() i
Krish


standard chartered bank
IN
To avoid "tools cannot be resolved" error
you can define tools as parameter tab ( ex : callWhen) . Otherwise you have to add the below line in your function
PublicAPI tools=ThreadContainer.get().getPublicAPI();


Capgemini
IN


Accenture
AU


Pegasystems Inc.
IN
Hi,
U can try "PublicAPI tools=ThreadContainer.get().getPublicAPI();"
hope it may help in ur case.
Thanks,
Mohan