Action script parameter from relevance of client setting on computer

Previously successfully executed the following
setting “action_start_was”=“yes” on “{Now}” for client
setting “action_start_was_sleep”=“60” on “{Now}” for client

Trying to get value of client computer setting action_start_was_sleep into a action script parameter action_start_was_sleep.

action log all
if {(exists setting “action_start_was” whose (Exists Value of it AND value of it = “yes”) of client)}
if {(exists setting “action_start_was_sleep” whose (Exists Value of it) of client)}
parameter “action_start_was_sleep” = "{(value of setting “action_start_was_sleep” of client)}"
endif
endif

Take action on above action fails with
Command failed (Relevance substitution failed) parameter “action_start_was_sleep” = “{(value of setting “action_start_was_sleep” of client)}” (action:87567)

What is the changed syntax for following statement that will work?
parameter “action_start_was_sleep” = “{(value of setting “action_start_was_sleep” of client)}”

Hmm…I’m seemingly not able to replicate this. The following worked for me:

if {exists setting "_BESClient_Comm_CommandPollEnable" whose (value of it as string = "1") of client}
    parameter "test"="{value of setting "_BESClient_Comm_CommandPollEnable" of client}"
    dos echo {parameter "test" of action} > C:\test
endif

Was the Parameter previously defined anywhere else in the action? Once set, a parameter cannot be redefined.

I also don’t know whether you can have spaces before and after the = symbol on defining a parameter.

Hi:

Below is the complete action code to show parameter action_start_was_sleep_seconds not previously defined.
I updated the following statement to match Aram’s example.
parameter “action_start_was_sleep_seconds”="{value of setting “action_start_was_sleep” of client}"

action log all
if {(exists setting “action_start_was” whose (Exists Value of it AND value of it = “yes”) of client)}
if {(exists setting “action_start_was_sleep” whose (Exists Value of it) of client)}
parameter “action_start_was_sleep_seconds”="{value of setting “action_start_was_sleep” of client}"
wait /bin/sh -c "sleep {parameter “action_start_was_sleep_seconds”}"
endif
endif

BigFix agent 9.5.7 on AIX 7.1 TL4 SP4 and Red Hat Enterprise Linux Server release 7.4 both fail on Take Action for above with
Normal Action Logging. action log all (action:87612)
Command failed (Relevance substitution failed) parameter “action_start_was_sleep_seconds”="{value of setting “action_start_was_sleep” of client}" (action:87612)

Hi Mike, I looked at your SF case and further testings done in the lab. It turned out that this double quotations around this “action_start_was_sleep” either corrupted and with funny characters. Even those it look quite normal by looking at it and if you look very closely with wordpad, the way of the double quotation look differently. See below.

parameter "action_start_was_sleep_seconds"="{value of setting “action_start_was_sleep” of client}"

Once I retyped the double quotation again, it worked fine. You could also see closely how the double quotation look like comparing to the “”.

parameter “action_start_was_sleep_seconds”="{value of setting “action_start_was_sleep” of client}"

I would suggest you to retype all the double quotation in your action script again to ensure there is no other corrupted double quotations.

Hi York, that fixed the relevance error. Thanks.

Great catch on the odd quotes!

I’d add that this often occurs from copy/pasting code into a rich document editor such as MS Word. When keeping a repository of code for copy/paste, be sure to use a plain-text editor, preferably without autocorrect or auto-formatting.

1 Like