Skip to content

HAS_JOB_ROLE Party Category

Description

Connects an :Appointment to a :JobRole.

See Buyer Contacts for more information.

Label

HAS_JOB_ROLE

Valid nodes

FromRelationshipToCardinality
Appointment
A node with the :Appointment label
:HAS_JOB_ROLEJobRole
A node with the :JobRole label and a specific name property
0..n

Properties

HAS_JOB_ROLE uses the standard relationship properties.

CREATE

The job role is assigned to the appointment via this HAS_JOB_ROLE relationship. Because a contact could have multiple roles at an organization, the contact can have multiple :HAS_JOB_ROLE relationships with specific roles. They cannot have multiple :HAS_JOB_ROLE relationships with the same job role.

However, the job role must be allowed for the role of the appointment's organization party, which is separately attached under APPOINTED_TO. This means the API developer must look at the organization to which the :Appointment is referencing using the APPOINTED_TO relationship:

cypher

// Collect all valid job roles from all the organization’s roles
// (and their associated subTypes) and then validatee that the
// provided job role is allowed before creating an appointment.
// If no valid job role is found, the query will throw an error:

MATCH      (org:Party {id: $orgId})
        -  [hr:HAS_ROLE]
        -> (role:Role)
WITH       org,
           hr.subType AS subType,
           role
MATCH      (role)
        -  [ajr:ALLOWED_JOB_ROLE]
        -> (jr:JobRole {name: $jobRoleName})
WHERE      ajr.subType = subType
WITH       org,
           collect(jr) AS validJobRoles
CALL       apoc.util.validate(
            size(validJobRoles) = 0,
            'Job role ' + $jobRoleName + ' is not allowed for org party ' + $orgId,
            []
           )
WITH       org,
           validJobRoles[0] AS validJobRole
MATCH      (person:Party {id: $personId})
CREATE     (appointment:Appointment {
             id: randomUUID(),
             fromDate: datetime()
           })
CREATE     (person)
        -  [:HAS_APPOINTMENT {
             id: randomUUID(),
             active: true
           }]
        -> (appointment)
CREATE     (appointment)-[:APPOINTED_TO]->(org)
CREATE     (appointment)-[:HAS_JOB_ROLE]->(validJobRole)
RETURN     appointment,
           validJobRole

UPDATE

DELETE

Examples

Confidential. For internal use only.