Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

1.

Enable Sandbox navigate Service Request > Service Scripts > Object Functions > Click on Add

def strEmails = "";


if (AssigneePersonName == "" || AssigneePersonName == null ) {
def srQueue = QueueName;
if(srQueue != "" || srQueue != null) {
def queueMemVo = SvcQueue?.resourceMembers;
if (queueMemVo != null) {
queueMemVo.reset();
while(queueMemVo.hasNext()) {
def queueResRow = queueMemVo.next();
if (strEmails == "")
strEmails = queueResRow?.EmailAddress
else
strEmails = strEmails + "," + queueResRow?.EmailAddress;
}
}
}
}
return strEmails;

2. Create a Custom field on Service Request and Choose field type = Formula, Formula Type = Text

Sensitivity: Internal & Restricted


Enter the formula details and click Next

In the script field enter Get_Member_Emails()

if ( (CategoryName == 'Payroll') || (CategoryName == 'Change my Bank Account') || (CategoryName ==


'Deductions') || (CategoryName == 'Payment Method') )

Sensitivity: Internal & Restricted


{
Get_Member_Emails()
}

3. Create an Object Workflow on the Service request to send e-mail notification to the list of emails
Navigate to Object Workflow > Service Request > Create as following

The object workflow can be 'When SR is created' or 'When SR is Update' [ as per this project I have chosen
‘When a record is updated’ update trigger]

The following condition must be used


if (isAttributeChanged('QueueId') && (AssigneePersonName == "" || AssigneePersonName == null))
return true;

On the same trigger on the email Add email notification [provide the name ‘Send Queue Resource Email’ ]

Click to email address


Click Field on Record and you will see the formula custom field you have created in step2. Move it to right side

Sensitivity: Internal & Restricted


4. Create an object trigger to send bell notification to the list of emails
Standard Object > Service Request > Service Scripts > Trigger > Add and Enter following script

Sensitivity: Internal & Restricted


Now as per this project need we have added additional condition to trigger only when specific category SR is
created

if ( (AssigneePersonName == "" || AssigneePersonName == null) &&


( (CategoryName == 'Payroll') || (CategoryName == 'Change my Bank Account') || (CategoryName ==
'Deductions') || (CategoryName == 'Payment Method') )
)
{
def srQueue = QueueName;
if(srQueue != "" || srQueue != null)
{
def queueMemVo = SvcQueue?.resourceMembers;
if (queueMemVo != null)
{
queueMemVo.reset();
while(queueMemVo.hasNext())
{
def queueResRow = queueMemVo.next();
def map = new HashMap();
map.put("Channels", ["ORA_SVC_BELL"]);
map.put("MessageText", 'SR is assigned to your queue');
map.put("RecipientPartyId", queueResRow?.ObjectId);
adf.util.sendNotification(adf, map)
}
}
}
}

Sensitivity: Internal & Restricted

You might also like