Edit

GetContactForRole (rolebits [, requestedfieldname])

Result Type: String

Definition: Must be used in the context of a selection of Name records, i.e. within a ForEach N in Name loop in a report. Returns the first contact (sorted by Order) with any of the requested role bits set. contact1 and contact2 are assumed to have bit #10000 / #20000 set (even though the actual role field is only 16 bits).

The result is all fields tab delimited unless a valid field name is supplied, in which case only that field is returned.

If the field name is "*", then ALL fields of all matching contacts are returned, tab and newline delimited

Examples:  N.GetContactForRole(1, "email")

returns the email address for role1 of whatever name record N is pointing to. If there is no role1 defined for N, an empty string is returned. If there is more than one contact defined as a role1, only the first is returned.

Availability:  In custom reports (note not in MWScript. In MWScript use GetAllContactEmailsForRole)