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:
|
|
If set, restricts the search to the indicated group. This can be
|
|
|
An array of |
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 |
|---|---|
|
|
The the
|
|
|
If set, this is the name of a property on the Attribute
entity. The method imposes a search restriction using the
|
|
|
If set, then the method tightens the |
|
|
If set, then the method restricts the search to users that have the specified
|
|
|
If set, then the method restricts the search to users that have an
|
|
|
If set, then the method restricts the search to users that have the specified
|
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:
- 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.
- 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 )
