Document toolboxDocument toolbox

Custom Events

Custom Logic: Events Grid example

The Events grid will store custom Event calls for PCR-360 to trigger Events in a particular instance of PCR-360. Using the image-20240820-173403.png button, a User can manually run their Custom Events.

Example Custom Event

Logic tab

The Logic tab is where the Custom Logic can be written and reviewed. A User can quickly review the code written for the specific event with the image-20240820-181526.png button. Users will be limited to the white-listed functions for PHP and some PCR-360 specific functions. A list of the functions can be seen in PCR-360 by clicking on the image-20240820-181538.png button.

Usage

In a typical event routine, some data is queried and then acted upon. The Custom Logic allows you to query any data in the database and then invoke the API write endpoints to update data or trigger other events like Bulk Updates.

Scope

These events are written and executed within a subset of PHP syntax, and at run time they have scope access to four arrays of data $data, $params, $user, and $backtrace. For security purposes, only a subset of PHP functions has been whitelisted.

$data

A key/value paired array of data that is being sent to the event.

  • For scheduled events this will be empty.

  • For Events triggered from Escalations it will contain the data from the originating event.

In this example, the “New Service Order Created” was used triggered an Escalation which then triggered the Custom Event

$data = { "action_after_save":null, "workflow_after_save":null, "equipment_after_save":null, "service_desk_recid":"-1061368010", "sd_number":"SO202401652", "due_date":null, "sd_type":"sd-service-order", "sd_source":"277", "sd_status":"284", "complete_on_date":null, "finalize_on_date":null, "csr":"191746", "description":null, "set_owner":"contact", "contact_owner":null, "billing_group":null, "requestor":null, "assoc_proj":null, "quoted_amount":null, "purchase_order":null, "impact":null, "urgency":null, "modified_by":"Rob Alber", "modified_date":"09\/13\/2024 17:30:28", "identifier":"340e0f1f626ff685cdd8", "RECID":26954, "TEMP_RECID":"-1061368010", "WRITE_TENANT_NAME":null, "TENANTS_RECID":"0", "PARENT_GRID":"gride6c6f78fa58601e7cf19", "sdassoc":{ "value":[ ], "identifier":"43fb7bf87fd32d2aa1f2", "total-records":0 }, "sda":{ "value":[ ], "identifier":"a67fdd2fb010d60fb739", "total-records":0 }, "from":null, "subject":null, "sde":{ "value":[ ], "identifier":"8ed645071ae14e9a93b5", "total-records":0 }, "sdest":{ "value":[ ], "identifier":"d2eb77063157f03a5677", "total-records":0 }, "sdwf":{ "value":[ ], "identifier":"79a49f99eb61d93f0117", "total-records":0 }, "sdc":{ "value":[ ], "identifier":"d48d7e477b78f9971250", "total-records":0 }, "default_gla":null, "sdg":{ "value":[ ], "identifier":"1d789d7b350a9c7c58cb", "total-records":0 }, "default_gla_display":null, "sdch":{ "value":[ ], "identifier":"ee632f064953ee74498d", "total-records":0 }, "sdlb":{ "value":[ ], "identifier":"e6a56ee8c11b5f708638", "total-records":0 }, "sdcb":{ "value":[ ], "identifier":"e1b0d76345d8af25180a", "total-records":0 }, "sdCableComplete":{ "value":[ ], "identifier":"ab97a9adfff7941ee146", "total-records":0 }, "sdact":{ "value":[ ], "identifier":"6e5f2255d53a70dcfb8a", "total-records":0 }, "sdeml":{ "value":[ ], "identifier":"0d2dcaf2da4ae40e0e8d", "total-records":0 }, "sdatt":{ "value":[ ], "identifier":"8a785a0cfad56084c347", "total-records":0 }, "udf":{ "243":{ "VALUE":null, "DATATYPE":"INTEGER" }, "246":{ "VALUE":null, "DATATYPE":"VARCHAR" }, "247":{ "VALUE":null, "DATATYPE":"VARCHAR" }, "256":{ "VALUE":null, "DATATYPE":"VARCHAR" }, "163":{ "VALUE":null, "DATATYPE":"VARCHAR" }, "140":{ "VALUE":null, "DATATYPE":"VARCHAR" }, "203":{ "VALUE":null, "DATATYPE":"VARCHAR" }, "56":{ "VALUE":"0", "DATATYPE":"BOOL" } }, "csr_display":"Cok, Ben", "contact_owner_display":null, "requestor_display":null, "assoc_proj_display":null, "purchase_order_display":null, "form-action":"save", "showHistoryReport":false, "save-new":"true", "updateDueDate":true, "cur_type":null, "triggerSaveEvents":true, "isFinalization":false, "isComplete":false, "wasOnHold":false, "isOnHold":false, "isVoided":false, "isCompletion":false, "slaSdcChanged":false, "prbCodeChanged":false, "serviceEquipmentChanged":false, "typeChanged":false, "statusChanged":false, "isCsrInitialAssignment":true, "csrChanged":true, "isAddNew":true, "workgroupPromptConfirm":false, "PRESAVE":false, "COMPLETE_DATE":[ ], "FINALIZED_DATE":[ ], "BILLED_DATE":[ ], "HOLD_DATE":[ ], "PENDING_DATE":[ ], "SERVICE_DESK_RECID":26954, "default_sdc":null, "filter":{ "CSR":"191746", "DESCRIPTION":null, "REQUESTOR":null, "SD_CONTACT_OWNER":null, "SD_DEPT_HIERARCHY_OWNER":null, "SD_DUE_DATE":null, "SD_NUMBER":"SO202401652", "SD_SOURCE":"277", "SD_STATUS":"284", "SD_URGENCY":null, "TYPE":"sd-service-order", "INQUIRY_EMAIL_BODY":null, "INQUIRY_EMAIL_SUBJECT":null, "INQUIRY_EMAIL_RECEIVED":null, "INQUIRY_EMAIL_SENDER":null, "INQUIRY_EMAIL_SENDER_EMAIL":null, "INQUIRY_EMAIL_TOPIC":null, "INQUIRY_EMAIL_PRIORITY":null, "EVENT_CONTACT":"101464", "EVENT_DATETIME":"Sep 13, 2024, 5:43 pm", "EVENT_DAYOFWEEK":"5", "EVENT_HOURMIN":"1743", "EVENT_RECID":26954, "UDF_56_SERVICE_DESK":"No", "UDF_140_SERVICE_DESK":null, "UDF_163_SERVICE_DESK":null, "UDF_203_SERVICE_DESK":null, "UDF_243_SERVICE_DESK":null, "UDF_246_SERVICE_DESK":null, "UDF_247_SERVICE_DESK":null, "UDF_256_SERVICE_DESK":null }, "server":{ "APPLICATION_ENV":"test", "APPLICATION_ENVDEBUG":"1", "APPLICATION_ENVPCR":"1", "HTTP_HOST":"alberr.2024-2mysql.dev-24.corp", "REMOTE_ADDR":"10.1.13.30" }, "eventBroadcastBy":"101464", "eventBroadcastTime":"Sep 13, 2024, 5:43 pm", "eventBroadcastDayofWeek":"5", "eventBroadcastHourMin":"1743", "criteria":{ "CSR":"191746", "DESCRIPTION":null, "REQUESTOR":null, "SD_CONTACT_OWNER":null, "SD_DEPT_HIERARCHY_OWNER":null, "SD_DUE_DATE":null, "SD_NUMBER":"SO202401652", "SD_SOURCE":"277", "SD_STATUS":"284", "SD_URGENCY":null, "TYPE":"sd-service-order", "INQUIRY_EMAIL_BODY":null, "INQUIRY_EMAIL_SUBJECT":null, "INQUIRY_EMAIL_RECEIVED":null, "INQUIRY_EMAIL_SENDER":null, "INQUIRY_EMAIL_SENDER_EMAIL":null, "INQUIRY_EMAIL_TOPIC":null, "INQUIRY_EMAIL_PRIORITY":null, "EVENT_CONTACT":"101464", "EVENT_DATETIME":"Sep 13, 2024, 5:43 pm", "EVENT_DAYOFWEEK":"5", "EVENT_HOURMIN":"1743", "EVENT_RECID":26954, "UDF_56_SERVICE_DESK":"No", "UDF_140_SERVICE_DESK":null, "UDF_163_SERVICE_DESK":null, "UDF_203_SERVICE_DESK":null, "UDF_243_SERVICE_DESK":null, "UDF_246_SERVICE_DESK":null, "UDF_247_SERVICE_DESK":null, "UDF_256_SERVICE_DESK":null }, "ORIGINAL_EVENT":"sd-order-created", "custom_identifier":"Alberr-Event-9323" }

Schedule tab

Debug tab

The Debug tab shows the results of debug function calls. This debug information is cleared after 24 hours.

Example

This example shows a Custom Event that invoking the call function: How can regular maintenance be scheduled for Equipment?