Add Service Request Resource

This is sample code to trigger a notification to a new resource member when that member is added to an SR.

You can copy and paste this sample code in Application Composer > Objects > Standard Objects > Service Request > Service Request Resource > Server Scripts.
/* DISCLAIMER: This trigger is provided only as a reference.
*  TRIGGER TYPE: Before Insert to Database
*  OBJECT: Service Request Resource (child of Service Request)
*  Use Case: Send a notification to a new resource member when that member is added to an SR.  
*/

try {
      def map = new HashMap();
     
      // Specify default MessageText
      def messageText = "You are now a team member"
     
      // Specifying the recipient
      def recipientPartyId = PartyPartyId
 
      //Resolving Parent child object relation. Use respective parent object apinames. Eg: ServiceRequestVO,HRHelpDeskRequestVO
      def objectCode='ServiceRequestVO'
   
      Long objectId = SrId
     
      // Specify one or more channels
      map.put("Channels",["ORA_SVC_BELL","ORA_SVC_EMAIL"]);
     
      map.put("MessageText", messageText);
      // The following can be used to pass a Long PartyId
      map.put("RecipientPartyId", recipientPartyId);
      map.put("ObjectCode", objectCode);
      map.put("ObjectId",objectId)
      if ( recipientPartyId != null ) {
      // Call to send notification
      adf.util.sendNotification(adf, map);
      }
   else {
      println("No recipient. Notification will not be sent.");
      }
      }
catch (e) {
      // Log the failure in groovy lo'RuntimeMessages'.
      println("Failure to trigger notification from Groovy Script " +
    e.getMessage());
      }