Help with Session Relevance

(imported topic written by SystemAdmin)

Hello Forum users,

I’m new here so forgive me if I’ve missed some already available help. I’m working on an application that will utilize a few aspects of the new REST API as well as the SOAP API on webreports, and I’ve been struggling a bit with my relevance code.

I have a statement like this that works fine:

(id of it as string, states of it, times issued of it) of (bes actions whose

(name of it contains “My Action Title” and targeted list of it contains “ComputerName1”))

This gives me the expected result, and finds the action ID, etc based on the computer. I similarly have a statement that searches on the name of a targeted computer as follows:

(id of it as string, states of it, times issued of it) of (bes actions whose

(name of it contains “My Action Title” and name of targeted computers of it contains “ComputerName1”))

This too works as expected.

Now what I’d like to to do, is actually attempt to combine this set of searches into a single one so I don’t have to make dual calls to the SOAP API:

I’ve tried the following: (and a number of variations of this, but cannot get it to work).

id of it as string, states of it, times issued of it) of (bes actions whose

(name of it contains “My Action Title” and (name of targeted computers of it contains “ComputerName1” or targeted list of it contains “ComputerName1”)))

Does anyone have any suggestions on how to correctly craft this statement so that I can simultaneously search out the targeted list and the targeted computer name?

I’m using the session relevance editor to test, and it’s quite helpful but it seems I’m missing the definitive guide to relevance language. (both session and action)

thanks,

Ryan

(imported comment written by Lee Wei)

You can try this statement:

(id of it as string, states of it, times issued of it) of bes actions whose ( name of it contains 
"My Action Title" and ( (

if (exists targeted lists of it)     then (targeted list of it contains 
"ComputerName1") 

else (

false) ) or (

if (exists targeted computers of it) then (name of targeted computers of it contains 
"ComputerName1") 

else (

false) ) ) )

Lee Wei

(imported comment written by SystemAdmin)

Lee Wei -

Thank you this works! I’m still a bit fuzzy on the relevance language, and the use of the if statement there makes only a little sense. The fact that it checks if there is a targeted list makes sense, but then the “then” statement i guess is just the equivalent to a true? It seems like the matching element is missing, but it does work and I’ll hopefully catch on.

Do you happen to know if there are any good session relevance guides out there? (other than yourself, I’ve seen so many posts that you’ve help solve over the years).

Thanks,

Ryan

(imported comment written by Lee Wei)

Hi Ryan,

You are doing it the right way, which is to try it out and asking questions along the way.

The reference materials that we have are all cataloged here:

Fixlet Authoring at developerWorks Wiki

Often we can use the Console and its many properties and Fixlets are guides on how to do something.

Back to your specific issue in this thread, the problem is that within the “BES Action” object, some properties are mutually exclusive - if you have a “targeted list”, you don’t have the “targeted computer” property. So we are checking with the if/then/else statement to ensure that the Relevance does not err out.

if/then/else have to return similar data types, in our case here, they are returning Booleans.

So are you related to Jason Pisani at your same company? I met Jason years ago.

Lee Wei

(imported comment written by SystemAdmin)

Thanks Lee Wei -

Yes, Jason is my brother and works on the other side of the fence now since we’ve split. Back at the time we were evaluating & implementing bigfix I was on the engineering side of the house. So unfortunately I missed out on the training that a number of people here had. In the past year or so I’ve been more and more involved with our implementation; and now with the REST API functionality it’s opened up the possibility for some external tooling so I’m knee deep in session relevance.

I appreciate the assistance, and I may frequent here more often.

Ryan