0 votes

I'm trying to build a simple scheduled task but having no success:

If the 'Account Expires' property is less than or equal to '%datetime,+30d%' AND
the 'Relationship' property equals 'Contractor' OR
the 'Relationship' property equals 'Agency Contract Temp' then
Send e-mail notification (%displayName%'s Account will expire on %accountExpires%. )

First, changing one logical operator in the IF statement changes the second logical operator automatically. I can only get 2 ORs or 2 ANDs in the above statement. Is it possible to have a mix of logical operators in the IF statement?

Second, if it is possible what is the order of precedence?
And can statements be grouped as in:
statement1 AND (statement2 OR statement3)?

by (520 points)

1 Answer

0 votes
by (216k points)

Hello,

Currently, combining different operators within the same set of actions and conditions is not supported. You can use either OR or AND operator within a set. Also, grouping of conditions is not supported.

To workaround this, you can use several sets of actions and conditions within a Scheduled task. For example, in the above case, the Scheduled Task can be set up as follows:

To add an action to a new action/condition set, use the Add action to a new set link.

Also, we strongly do not recommend checking for account expiration by directly checking the value of the Account Expires property. The thing is that when an account is set up to never expire, the value of the Account Expires property equals 0. So, if your condition is If the 'Account Expires' property is less than or equal to '%datetime,+30d%', the condition is also met for all accounts that never expire, because 0 will always be less than the current date. We recommend the If account/password <expiration status> condition. This condition type properly handles accounts that never expire.

Alternatively, if you are planning to build a very complicated structure of conditions, you can use the If PowerShell script returns True condition and checks all the conditions that you need with the help of the if/else/elseif statements in the script.

For an example of how to use the condition, see the step 6 of the Validate/Modify User Input Using a Script Tutorial.

0

Thank you for your guidance.
Will the account/password <expiration status> condition also ignore expiration status = unspecified?

0

Hello,

Yes.

Related questions

0 votes
1 answer

Greetings! Is there a way to have multiple logical operators in a business rule? I can create a rule with 'If this AND that AND the other thing, THEN do ... helpdesk staff from modifying group membership for a handful of sensitive AD groups. Thanks! Marty

asked Jan 4, 2017 by bouillon (150 points)
0 votes
1 answer

Using the powershell module, I know how to create a scheduled task, and also how to bind to a scheduled task that is already known. I also have used code to try creating ... same time as another. These are all one-time tasks and will be removed once executed.

asked Jan 19 by aweight (40 points)
0 votes
1 answer

So I have custom forms for onboarding / offboarding users. We sometimes know 2-3 weeks in advance so I would like to add the ability to schedule these for the future. I ... to take all the data that was inputed and then process the request on the given date?

asked Aug 4, 2023 by thatcher (120 points)
0 votes
1 answer

Hello! how do i manage do get adaxes to remove all groups from the user after one month? We have a Business Rule where you can add an end of Date when the Account ... value field the powershell script works but not with the +1 Month. Thanks for your help!

asked Jun 14, 2023 by eww ag (140 points)
0 votes
1 answer

seting up a scheduled task to move users to thier correct OU. For some we can do this based on employee type and direct to a specific OU. For most of our users we will have to script this to move to the manager's OU.

asked Apr 12, 2023 by mightycabal (1.0k points)
3,351 questions
3,052 answers
7,791 comments
545,079 users