Configure an Object Function for Initiate Action Plan
You must configure an object function for initiating action plan.
Following are the steps:
-
Sign in to Oracle CX Sales using Administrator role.
-
Navigate to Application Composer.
-
Go to Service Request > Server Scripts.
-
Go to Object Functions tab.
-
Click New icon to add a new object function.
-
Provide the function name as LaunchProcess.
-
Enter the following groovy code:
def POST_param = [ srNumber: SrNumber, deceasedName: nvl(PrimaryContactPartyName,"null"), deceasedDate: DateOfDeath_c, reportedBy: nvl(ReporterName_c,"null"), reportersPhone: nvl(ReportedByFormattedPhoneNumber,"4372541567"), primaryContact: nvl(PrimaryContactPartyName,"null"), primaryContactId: PrimaryContactPartyId, primaryContactsPhone: nvl(PrimaryContactFormattedPhoneNumber,"4372541555") ] println("srNumber:"+POST_param.srNumber) println("deceasedName:"+POST_param.deceasedName) println("deceasedDate:"+POST_param.deceasedDate) println("reportedBy:"+POST_param.reportedBy) println("reportersPhone:"+POST_param.reportersPhone) println("primaryContact:"+POST_param.primaryContact) println("primaryContactId:"+POST_param.primaryContactId) println("primaryContactsPhone:"+POST_param.primaryContactsPhone) println("ProcessStatus_c:"+ProcessStatus_c) if (ProcessStatus_c != 'NOTSTARTED') { println("Process can only be activated once.") return } if (PrimaryContactPartyName == null) { def msg='Please fill in "Deceased Name" field before initiating action plan.' throw new oracle.jbo.ValidationException(msg) return } if (DateOfDeath_c == null) { def msg='Please fill in "Date of Death" field before initiating action plan.' throw new oracle.jbo.ValidationException(msg) return } println("CaseType_c:"+CaseType_c) if (nvl(CaseType_c,"").equalsIgnoreCase("DECEASED_ESTATE")) { println("Invoking process..") def conn=adf.webServices.InvokeProcess //This maps to the WS name created in previous steps try{ def result = conn.POST(POST_param) def instanceId=result["id"].toString() println("instanceId:"+instanceId) setAttribute('ProcessInstanceId_c', instanceId) setAttribute('ProcessStatus_c', "ACTIVATED") setAttribute('StatusCd', "ORA_SVC_INPROGRESS") println("Status:"+conn.statusCode) }catch(Exception e){ println("Headers:"+conn.responseHTTPHeaders) println("Status:"+conn.statusCode) println("Error:"+e) def msgError='Failed to initiate action plan. Please contact your administrator.' throw new oracle.jbo.ValidationException(msgError) } }
-
Click Save and Close.