0 votes

Is there a way to use a Business Unit as a condition of a Business Rule? There's a condition called "If an Initiator is a member of <business unit>", but not a generic "If <object> is a member of <business unit"

It seems to me to be a logical use for Business Units, but I've just purchased the tool, so I'm still learning and I might have missed it.

Thx!

--Joel

by (510 points)

1 Answer

0 votes
by (216k points)
selected by
Best answer

Update 2019

Starting with version 2019.1, the If the object belongs to <Business Unit> condition is available in business rules, custom commands and scheduled tasks.

Original

Hello Joel,

The If <object> is a member of <Business Unit> condition is not present in Adaxes because there is basically no need for it. When you define the Activity Scope for a Business Rule or Scheduled Task, you can include or exclude a Business Unit, which is approximately the same as if you've put the If <object> is / is not a member of <Business Unit> condition in the rule or task. However, if you can't do without this condition, you can easily check whether an object is a mmber of a Business unit with the help of a PowerShell script. For example, the following script returns True if the target object on which a Business Rule, Custom Command or Scheduled Task is executed, is a member of a Business Unit named My Unit:

$businessUnitName = "My Unit" # TODO: modify me

$Context.ConditionIsMet = $False

# Search Business Units with the name specified
$businessUnitsPath = $Context.GetWellKnownContainerPath("BusinessUnits")
$searcher = $Context.BindToObject($businessUnitsPath)
$searcher.SearchFilter = "(&(objectCategory=adm-BusinessUnit)(name=$businessUnitName))"
$searcher.SearchScope = "ADS_SCOPE_SUBTREE"
$searcher.PageSize = 500
$searcher.ReferralChasing = "ADS_CHASE_REFERRALS_NEVER"

try
{
    $searchResult = $searcher.ExecuteSearch()
    $units = $searchResult.FetchAll()
    if ($units.Count -eq 0)
    {
        $Context.LogMessage("No Business Units with name '$businessUnitName' found.", "Warning")
        return
    }

    foreach ($unitId in $units)
    {
        $unit = $Context.BindToObject($unitId.AdsPath)
        if ($unit.IsMember($Context.TargetObject))
        {
            $Context.ConditionIsMet = $True
            return
        }
    }

}
finally
{
    $searchResult.Dispose()
}

The script must be used with the If PowerShell script returns true condition. For information on how to add and configure such a condition, see step 6 in the following tutorial: http://www.adaxes.com/tutorials_Simplif ... Script.htm.

0

Thank you! That was what I was missing!

--Joel

Related questions

0 votes
1 answer

Hi We have a set of business rules which are used for creating new distribution lists, these rules all have the same activity scope of a number of OUs, but the number of OUs ... when a new OU is created, it's not missed from the activity scope. Thanks Matt

asked May 12, 2022 by chappers77 (2.0k points)
0 votes
1 answer

I created a scheduled task (to export data) with a domain as its activity scope, runs perfectly. I modified it to use a Business Unit as its activity scope, now it ... the task effective for" should be checked, but the property is not editable in the dialog.

asked Mar 23, 2015 by sbanks (270 points)
0 votes
1 answer

Is it possible to create a business unit and have it auto populate with group owners in a specific OU. I've tried a few scripts to get propertie adm-managedbylist but none have worked so far.

asked 6 days ago by C27 (20 points)
0 votes
1 answer

I have a specific computer property pattern for three different types of computers, which live in three different OUs and are in three different business units. I will have ... How do I enforce a property pattern for a specific business unit at creation time?

asked Jul 17, 2023 by bennett.blodinger (60 points)
0 votes
1 answer

we have created some business units which only return certain items in our directory. when using the web ui, how do we restrict browing functions to only look in the business ... unit. if this is not possible, how is it envisaged that these units are used?

asked Apr 14, 2023 by i*windows (280 points)
3,549 questions
3,240 answers
8,232 comments
547,820 users