Client Setting based on AD Path

I’m trying to define a client setting based on reading some content from the AD path of a computer. Here is some sample ActionScript:

_if (exists true whose (if true then (exists (if exists value of settings “_BESClient_ActiveDirectoryPathOverride” of client then value of setting "BESClient_ActiveDirectoryPathOverride" of client else if exists true whose (if true then exists distinguished name of local computer of active directory else false) then distinguished name of local computer of active directory else “”) whose (it as string as lowercase contains “Marketing” as lowercase))else false)) then (setting “Area”=“Marketing”) else
_if (exists true whose (if true then (exists (if exists value of settings “_BESClient_ActiveDirectoryPathOverride” of client then value of setting "BESClient_ActiveDirectoryPathOverride" of client else if exists true whose (if true then exists distinguished name of local computer of active directory else false) then distinguished name of local computer of active directory else “”) whose (it as string as lowercase contains “Sales” as lowercase))else false)) then (setting “Area”=“Sales”) else “N/A”

Even though the lines show as completed on the endpoints, they are not adjusting the expected setting. No changes seem to be made.

If I break this out to individual fixlets and use the relevance of the fixlet to find the AD path, then I can easily use this ActionScript:

setting “Area”=“Sales” on “{now}” for client

with this relevance:

_(version of client >= “6.0.0.0”) AND (exists true whose (if true then (exists (if exists value of settings “_BESClient_ActiveDirectoryPathOverride” of client then value of setting "BESClient_ActiveDirectoryPathOverride" of client else if exists true whose (if true then exists distinguished name of local computer of active directory else false) then distinguished name of local computer of active directory else “”) whose (it as string as lowercase contains “Sales” as lowercase)) else false))

This works fine, but means I need to create a separate fixlet for each AD OU. My preference is one fixlet which checks AD path and assigns the proper client setting.

Any help fixing my ActionScript would be appreciated!

You seem to be mixing Action Script with Relevance.
To apply the setting, you’ll need the ActionScript command 'setting’
To determine a value for the setting, you’ll need to use Relevance Substitutions within the ‘setting’ command.

There are a couple of ways to express this…I’m not in the console and haven’t checked the parentheses match, but this is the general form…

if {(exists true whose (if true then (exists (if exists value of settings “_BESClient_ActiveDirectoryPathOverride” of client then value of setting "BESClient_ActiveDirectoryPathOverride" of client else if exists true whose (if true then exists distinguished name of local computer of active directory else false) then distinguished name of local computer of active directory else “”) whose (it as string as lowercase contains “Marketing” as lowercase)) else false)) }

setting "Area"="Marketing" on "{parameter "action issue date" of action}" for client

elseif {(exists true whose (if true then (exists (if exists value of settings “_BESClient_ActiveDirectoryPathOverride” of client then value of setting "BESClient_ActiveDirectoryPathOverride" of client else if exists true whose (if true then exists distinguished name of local computer of active directory else false) then distinguished name of local computer of active directory else “”) whose (it as string as lowercase contains “Sales” as lowercase))else false)}

setting "Area"="Sales" on "{parameter "action issue date" of action}" for client

endif

Another way to do it would combine the values lookups together…something like

setting "Area"="{if (relevance lookup one) then (value one) else if (relevance lookup two) then (value two) else "unknown"}" on "{parameter "action issue date" of action}" for client

1 Like

Thanks for the quick reply. Is there a reason you’re using “action issue date of action” rather than {“now”} in your ActionScript?

So here is the new ActionScript, but I’ve still got some errors:

if (exists true whose (if true then (exists (if exists value of settings “_BESClient_ActiveDirectoryPathOverride” of client then value of setting “BESClient_ActiveDirectoryPathOverride” of client else if exists true whose (if true then exists distinguished name of local computer of active directory else false) then distinguished name of local computer of active directory else “”) whose (it as string as lowercase contains “Marketing” as lowercase)) else false))
then setting “Area”=“Marketing” on “{now}” for client

elseif (exists true whose (if true then (exists (if exists value of settings “_BESClient_ActiveDirectoryPathOverride” of client then value of setting “BESClient_ActiveDirectoryPathOverride” of client else if exists true whose (if true then exists distinguished name of local computer of active directory else false) then distinguished name of local computer of active directory else “”) whose (it as string as lowercase contains “Sales” as lowercase))else false))

then setting “Area”=“Sales” on “{now}” for client
endif
else “N/A”

Returning syntax error:

  • ‘on’ unexpected following primary expression

I tried removing the ‘on’ clause and it complained about the ‘for client’ part, and when I removed that it complained about that.

I’ll keep working on it. If you have other thoughts or input it would be appreciated!

See Is the effective date value necessary for adding client settings?

You are still muddling up relevance and actionscript.

For starters:
You aren’t using curly braces where you have relevance substitution
Actionscript doesn’t use ‘then’ in its ‘if’ statements
You have an ‘else’ after the final ‘endif’