Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Each of the different types of Custom Logic: Custom Events, Custom API, and Custom Validation share these common syntax and available functions.

...

List Code of the specified record. Returns NULL if nothing is found.


call

The Custom API and Custom Events can invoke the Write methods for API types by using the call function. This function allows passing data from the Custom API or Events to the API logic.  When invoking this from the Custom API this feature allows you to reformat the incoming API data - perform data validation and lookup and then handoff the properly formatted data to write data.  When invoked from a Custom Event it allows scheduled or triggers events to update this data.

Code Block
languagephp
array $this->call ( string $method, array $bind_params);
Parameters

$method The callable method name. The available callable methods: saveCable, saveContact, saveEquipment, saveGla, saveService, and saveServiceDesk

$params An array of key payload data that is passed to the other API calling function.

Return Values

The function returns a result array containing 'data' which specifies the outcome of the call. For a successful call to saveServiceDesk, this array contain the Service Desk item/action that was created.

Example

In this example, the $payload array contains all the parameters required to create a Service Order and Action

Code Block
languagephp
    $result = $this->call("saveServiceDesk", $payload);
    $response["servicedesk_number"] = $result["data"];
Example

In this example, the Contact API is being invoked via the Custom API endpoint

Code Block
languagephp
$contact_request = [
    "customer_number" => "ABC123",
    "last_name" => "Help",
    "first_name" => "PCR",
    "email" => "help@pcr.com",
    "email_directory" => 1,
    "phone_number" => "616-555-1212",
    "phone_primary" => 1,
    "phone_type" => 1234, // RECID from Lists
    "phone_directory" => 1,
    "status" => 1,
    "contact_directory" => 1,
    "contact_types" => "CUSTOMER",
];
$result_contact = $this->call("saveContact", $contact_request);
if($result_contact["status"] == "success") {
    $response["contact"] = $result_contact["data"];
}


Other allowed functions & syntax

...

PHP Constants: NULL, TRUE, FALSE

Child pages (Children Display)
styleh6
sorttitle