assignByUserAttributes

  • boolean assignByUserAttributes(attributeBasedAssignmentCriteria, includeSubGroups, currentGroup)

This method assigns an assignable item to the user who best matches the set of user attribute constraints defined in the attributeBasedAssignmentCriteria parameter.

If no user matches the criteria specified by the method, the method assigns the item to the item owner. For example, if the method cannot determine a user from the supplied criteria, it assigns an activity to the owner of the policy associated with the activity.

The AttributeBasedAssignmentCriteria object contains two fields:

Group

If set, restricts the search to the indicated group. This can be null.

AttributeCriteria

An array of AttributeCriteriaElement entities.

The AttributeCriteriaElement entities represent the conditions to be met. If more than one AttributeCriteriaElement entity is present, the method attempts to assign the assignable entity to those users who satisfy all of them. In other words, the method performs a Boolean AND operation on the restrictions.

The AttributeCriteriaElement entity has a number of fields, which are all optional. These fields can interact in very dependent ways, depending on the value of UserField.

Field

Description

UserField

The the AttributeCriteriaElement behaves differently depending on whether the UserField property contains an actual value:

  • If set, then UserField must be the name of a property on the User entity. The method imposes a search restriction using the Operator and Value fields to find users based on their value for this field.
  • If null, then the method imposes a search restriction based on attributes of the user. The exact restriction imposed can be more or less strict based on the other fields set:

AttributeField

If set, this is the name of a property on the Attribute entity. The method imposes a search restriction using the AttributeValue field to find users based on the user having the appropriate value for the named field for some attribute.

AttributeType

If set, then the method tightens the AttributeField-based restriction to Attributes only of the indicated type.

AttributeValue

If set, then the method restricts the search to users that have the specified AttributeValue only.

State

If set, then the method restricts the search to users that have an Attribute with the indicated value for State.

Value

If set, then the method restricts the search to users that have the specified Value for an Attribute that satisfies the other criteria.

The assignByUserAttribute group parameters

You use the currentGroup and includeSubGroups parameters to further restrict the set of users under consideration to certain groups or subgroups. The currentGroup parameter can be null. If it is non-null, the assignment method uses the parameter for the following purposes:

  1. The assignment method maintains separate round-robin states for the search criteria within each group. This is so that PolicyCenter can use the method for group-specific assignment rotations.
  2. If the method selects a user, it uses the supplied group to determine the best group for the assignment:
    • If the user is as a member of multiple subgroups under the supplied group, the method assigns the object to the closest group in the hierarchy to the supplied group.
    • If the user is a member of multiple groups at the same level of the group hierarchy, the method assigns the object to one of these groups randomly.
    • If the user is not a member of any subgroup under the supplied group, the method assigns the object to the supplied group.
    • If the supplied group value is null, the method assigns the object to the first group it finds of which the user is a member. The user must belong to at least one group for this assignment to succeed.

Assign by attribute example

At times, it is important that you assign a particular policy to a specific user, such as one who speaks French or one who has some sort of additional qualification. It is possible that these specially qualified users exist across an organization, rather than concentrated in a single group.

The following example searches for all of User entities who have an AttributeType of language and Attribute value of French.

var attributeBasedAssignmentCriteria = new AttributeBasedAssignmentCriteria()
var frenchSpeaker= new AttributeCriteriaElement()
frenchSpeaker.AttributeType = UserAttributeType.TC_LANGUAGE
frenchSpeaker.AttributeField = "Name" 
frenchSpeaker.AttributeValue = "French"
attributeBasedAssignmentCriteria.addToAttributeCriteria( frenchSpeaker )
activity.CurrentAssignment.assignByUserAttributes(attributeBasedAssignmentCriteria , false, activity.CurrentAssignment.AssignedGroup )