Skip to content

Customer Code Examples

nlil edited this page Jul 17, 2012 · 3 revisions

Retrieving Remedy customer data

There are two methods for fetching Remedy customer data:

  • Search by the customer's Campus ID number (CID) (customerGetByCID)
  • Search by the customer's login id (customerGetByLogin)

###Searching by CID

<?php

/***************************************************************  
 *  
 * Example: Lookup a Remedy customer by their Campus ID number (CID)
 *  
 ***************************************************************/

require_once 'Ncstate/Service/Remedy.php';

// create a new Remedy object  
$remedy = new Ncstate_Service_Remedy($user, $pass);

// the CID must be an 9 digit number  
$cid = '000005667';

try {
    $result = $remedy->customerGetByCID($cid);
}
catch (Ncstate_Service_Exception $e) {
    die('An error occurred while getting the customer:' . $e->getMessage());
}

print "Customer login name is: $result->login \n";
print_r($result);

?>

###Searching by login name

<?php

/***************************************************************  
 *  
 * Example: Lookup a Remedy customer by their login name
 *  
 ***************************************************************/

require_once 'Ncstate/Service/Remedy.php';

// create a new Remedy object  
$remedy = new Ncstate_Service_Remedy($user, $pass);

// the login name must be specified  
$login = 'nlil';

try {
    $result = $remedy->customerGetByLogin($login);
}
catch (Ncstate_Service_Exception $e) {
    die('An error occurred while getting the customer:' . $e->getMessage());
}

print "Customer CID is: $result->cid \n";
print_r($result);

?>