Question
How to pass a localized parameter to a parameterized message rule in a validate rule.
Hi All,
We have a validate rule in which we are throwing an error message on a property with the help of a parameterized message rule when the validation conditions fail as shown here.
Selected\tEach Option
Where Selected is a message rule of category 'Error' having the message 'should be selected'.We have a requirement that we need to localize the error message in French. I have a created pyCaption field value for the 'Each Option' in localization ruleset and also created the localized message rule in localization ruleset. Used the below logic to pass to localize the message rule in validate rule.
Selected\t@(PegaRULES:Utilities).getLocalizedText('Each Option', 'pyCaption', tools)
It didn't work. It's picking the message in the localized message rule 'Selected' but not the content from the localized field value of 'Each Option' of type 'pycaption' and showing the error message like below.
Each option devrait être sélectionné
I've tried using the below logics without = also before the function.
Selected\t=@(PegaRULES:Utilities).getLocalizedText('Each Option', 'pyCaption', tools) Selected\t=@(PegaRULES:Utilities).getLocalizedText(Each Option, pyCaption, tools) Selected\t=@(PegaRULES:Utilities).getLocalizedText('Each Option', .pyCaption, tools) Selected\t=@(PegaRULES:Utilities).getLocalizedText(Each Option, '.pyCaption', tools) Selected\t=@(PegaRULES:Utilities).getLocalizedText("Each Option", .pyCaption, tools) -- Here it throws an error while saving the validation rule as it is not accepting the "", unlike in an activity or in a DT it accepts the "".
Please help on this issue.
Adding to the above content,
I was suggested to use the approach of joining the validation condition used on the property with @XYZ.SetParameters("{\"Hello\":\""+@getLocalizedText("Each Option", "pyCaption", tools)+"\"}"). We have used AND to join those validation conditions. Here, in message rule for this approach, we passed only message rule name i.e., Selected without parameter.
Please let me know is it allowed to pass the function 'getLocalizedText' as a parameter to a parameterized message rule in a validate rule to localize the error message and also suggest me an approach in which the exisiting parameterized message rule reusability should not be disturbed i.e., giving the 'Each option should be selected' directly as a message in validate rule and creating a localized version of that message rule in localization ruleset. Thank you in advance.