Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
Highlighted
danje571
New Member.
904 views

Velocity template on rule using filter

Jump to solution

Hi all I4ve thousand rules that use a filter with some other conditions embedded into the rules.

As I d'ont want to modify all rules, I would like to put a variavle using Velocity Template.

The variable is located on the filter.

The goal of the Velocity template is to detect the hostname and then popumlate en fiel to detect TEST and PROD system:

#if ($finalDeviceHostName.contains("LVP"))"PROD" #elseif ($finalDeviceHostName.contains("LVU"))"UAT"#end

I try to put this into my filter, which is used into my rules.

But I can't see the variable in the agregation fiel of the rule, the rule is not working 😕

Do you have any idea?

Labels (1)
0 Likes
1 Solution

Accepted Solutions
danje571
New Member.

Re: Velocity template on rule using filter

Jump to solution

My goal is to create a variable that check the name of the hostname, which contains always LVU for UAT environment and LVP for the PROD.

For the moment, In all my rules, I use a filter that contains all customers where I need to trigger an alert:

Example:

Filter:

For the moment local variable in the filter, but; refer to your previous answer it can't work

Then all my rules refers to this filter, like this:

aggregation (sorry to long, for screenshot, i put the syntax)

Action:

Local variable contains nothing.

As my prevous test, it explain that I can use the local variable on my rules.

This is what I search now.

Result of the velocity template should be to using the variable detectUATPROD

And put the result into deviceCustomString6 variable

is it most clear?

Regards

View solution in original post

0 Likes
6 Replies
balahasan.v1 Acclaimed Contributor.
Acclaimed Contributor.

Re: Velocity template on rule using filter

Jump to solution

Hi Danje,

U can't refer/use the variables used in the Filter on Rule. U need to redefine the same set of variables in the rule in order to aggregate it. Or make the Filter variable as Global Variable and call it in the Rule Aggregation

0 Likes
rkent1 Acclaimed Contributor.
Acclaimed Contributor.

Re: Velocity template on rule using filter

Jump to solution

Ah, - one step ahead as usual

0 Likes
balahasan.v1 Acclaimed Contributor.
Acclaimed Contributor.

Re: Velocity template on rule using filter

Jump to solution

Hi Richard, Don't Quit joking Bro.. Coz I Love ur sense of Humor

0 Likes
danje571
New Member.

Re: Velocity template on rule using filter

Jump to solution

Ohhh shit....

Can I move the filter as a Global variable easily, without modifying my 150 rules manually 😕

I'm afraid of the answer 😛

0 Likes
balahasan.v1 Acclaimed Contributor.
Acclaimed Contributor.

Re: Velocity template on rule using filter

Jump to solution

Hi Danje,

U can create Global variables from all the local variables used under the filters. Just u need to Click "Make Global" -> Choose Location -> Don't replace the Local variable.

But before doing all these. Plz do know what u r trying to do with it

deees.JPG

0 Likes
danje571
New Member.

Re: Velocity template on rule using filter

Jump to solution

My goal is to create a variable that check the name of the hostname, which contains always LVU for UAT environment and LVP for the PROD.

For the moment, In all my rules, I use a filter that contains all customers where I need to trigger an alert:

Example:

Filter:

For the moment local variable in the filter, but; refer to your previous answer it can't work

Then all my rules refers to this filter, like this:

aggregation (sorry to long, for screenshot, i put the syntax)

Action:

Local variable contains nothing.

As my prevous test, it explain that I can use the local variable on my rules.

This is what I search now.

Result of the velocity template should be to using the variable detectUATPROD

And put the result into deviceCustomString6 variable

is it most clear?

Regards

View solution in original post

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.