Set the HR Help Desk Service Request BU
The BUs on an HR Help Desk Request are set as follows:
-
SR is created by Agent: If the BU on the SR is set as the BU associated with the signed in users resource organization and multiple BU's are associated with the user's resource organization, then the primary is used.
-
SR created by Employee: If employees aren't resources and they don't have a resource organization, the BU on the SR is set as the default BU.
-
SR created by email: If the SR is created by email, then the BU of the SR is determined based on the BU of the email channel.
-
If your requirement is to set a different BU based which employee has signed in, then you must write a groovy script to dynamically set a different BU based on the employee who's signed in.
Only agents are set up as resources and associated with a resource organization. HR Help Desk user employees aren't resources so the business unit on the HR Help Desk service request is set to the value of the profile option HZ_DEFAULT_BU_CRM. To set the BU on the SR to the BU of the employee rather than the default, you must configure the following:
Add an After Create Trigger to Update the BU on the SR
Complete the following steps in Application Composer.
-
In Application Composer, navigate to the Server Scripts under Service Requests.
-
Go to the Triggers tab.
-
Create a new Trigger with the following.
-
Trigger = After Create
-
Enter an appropriate name
-
Paste the following code in the script section of the trigger:
-
if(StripeCd == "ORA_SVC_HCM")
{
def hcmPersonListVL = hcmPersonList
while(hcmPersonListVL.hasNext())
{
def hcmPersonListRow = hcmPersonListVL.next();
def actualTerminationDate = hcmPersonListRow?.ActualTerminationDate;
if(actualTerminationDate == null)
{
def EmpBuName = hcmPersonListRow?.BusinessUnitName;
if (EmpBuName != null)
{
def buID;
def buVO = getAttribute("BusinessUnitsLOV");
buVO.reset()
while (buVO.hasNext())
{
// access the next row in the row iterator
def curBU = buVO.next()
if(curBU.getAttribute("Name") == EmpBuName)
{
buID= curBU.getAttribute("BusinessUnitId");
println('buID:'+buID);
setAttribute("BUOrgId", buID);
break;
}
}
}
}
}
}
Add an After Field Trigger on the Primary Contact ID Field to Update the BU on the SR
If an agent creates an SR on behalf of the employee, then the After Create trigger on the SR Object wouldn't default the BU of the Primary Point of Contact's BU. To do that, you must add an After Field Changed field Trigger on the Primary Contact ID.
Complete the following steps in Application Composer.
-
In Application Composer, navigate to the Server Scripts under Service Requests.
-
Go to the Triggers tab.
-
Create a new Field Trigger with the following:
-
Trigger = After Field Changed
-
Field Name = Primary Contact ID
-
Enter an appropriate name
-
Paste the following code in the script section of the trigger:
-
if(StripeCd == "ORA_SVC_HCM")
{
def hcmPersonListVL = hcmPersonList
while(hcmPersonListVL.hasNext())
{
def hcmPersonListRow = hcmPersonListVL.next();
def actualTerminationDate = hcmPersonListRow?.ActualTerminationDate;
if(actualTerminationDate == null)
{
def EmpBuName = hcmPersonListRow?.BusinessUnitName;
if (EmpBuName != null)
{
def buID;
def buVO = getAttribute("BusinessUnitsLOV");
buVO.reset()
while (buVO.hasNext())
{
// access the next row in the row iterator
def curBU = buVO.next()
if(curBU.getAttribute("Name") == EmpBuName)
{
buID= curBU.getAttribute("BusinessUnitId");
println('buID:'+buID);
setAttribute("BUOrgId", buID);
break;
}
}
}
}
}
}
You can't expose the BU ID field on the SR if you're adding this trigger. This is because if you update the BU using the After Field Changed Trigger, the UI wouldn't be updated with the value set in the trigger.
If you want the agent have the ability to change the BU, don't use the After Field Changed Trigger. Or, you can use this trigger but don't expose the BU on the Service Request page.
Give the Employee Privilege to Update BU on the SR
Make sure all the employees have the Update Service Request Business Unit privilege in the security console.
You can do this in two ways.
-
Option 1:
-
Create a new job role and add associate the Update Service Request Business Unit privilege to the role.
-
Associate this role to all your employees.
-
-
Option 2:
-
If all your employees are already associated with a custom role, you can add Update Service Request Business Unit privilege to that custom role.
-