Set Service Request Contact List from Contact Relationships

You must set service request contact list from contact relationships.

Following are the steps:

  1. Sign in to Oracle CX Sales using Administrator role.

  2. Navigate to Application Composer.

  3. Go to Service Request > Server Scripts > Triggers.

  4. In the Object Triggers section, click New icon.

  5. For the trigger, select Before Insert in Database.

  6. Enter the trigger name as InsertRecord.

  7. Add the following groovy code in trigger definition:

    if (Type_c == "DECEASED_ESTATE" && ContactPerson != null)
    {
      def conVO = contacts
      ArrayList contactParties = new ArrayList()
      while (conVO.hasNext())
      {
        def con = conVO.next()
        contactParties.add(con.PersonProfileId)
      }
      def relVO = ContactPerson.Relationship
      while (relVO.hasNext())
      {
        def relation = relVO.next()
        if (relation.ObjectType == "PERSON" && contactParties.indexOf(relation.ObjectId) == -1)
        {
          def relationCopy = conVO.createRow()
          relationCopy.setAttribute("SrId",SrId)
          relationCopy.setAttribute("ContactPartyName",relation.ObjectPartyName)
          relationCopy.setAttribute("PartyId",relation.ObjectId)
          relationCopy.setAttribute("Relationship_c",relation.RelationCode)
          conVO.insertRow(relationCopy)
        }
      }
    } 
  8. Click Save and Close.