assignUserByLocationAndAttributes

  • boolean assignUserByLocationAndAttributes(address, attributeBasedAssignmentCriteria, includeSubGroups, currentGroup)

The assigUserByLocationAndAttribute method is a combination of the assignUserByLocation and assignByUserAttributes methods. You can use it apply both kinds of restrictions simultaneously. In a similar fashion to the assignUserByLocation method, you can use this method in situations in which the assignment needs to take a location into account. (This is the address of a policy holder, for example.) You can then impose additional restrictions, such as the ability to handle large dollar amounts or foreign languages, for example.

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.

As with the assignByUserAttribute assignment method, if no user matches the criteria specified by the attributeBasedAssignmentCriteria, the method assigns the object to the owner of the object being assigned.

The following example searches for a French speaker that is closest to a given address.

var attributeBasedAssignmentCriteria = new AttributeBasedAssignmentCriteria()
var frenchSpeaker = new AttributeCriteriaElement()
frenchSpeaker.AttributeType = UserAttributeType.TC_LANGUAGE
frenchSpeaker.AttributeValue = "french"
attributeBasedAssignmentCriteria.addToAttributeCriteria( frenchSpeaker )

activity.CurrentAssignment.assignUserByLocationAndAttributes(Activity.Account.PrimaryLocation.Address,
        attributeBasedAssignmentCriteria , false, activity.CurrentAssignment.AssignedGroup)