Sidebar

Using iTop

Creating your iTop

iTop Customization

"How to" examples
DataModel

User Interface

Automation & Ticket management

Portal Customization

:: Version 3.2.0 ::

Add a Log entry in PHP

Prerequisite: You must be familiar with the Syntax used in Tutorials and have already created an extension.
We also assume that you are familiar with dashboard design within iTop and OQL.

learning:
Within a PHP method, adding an entry to a caselog
level:
Medium
domains:
PHP, Caselog, Attribute
methods:
PrefillTransitionForm, AddLogEntry
min version:
2.6.0

If you want to add within a PHP method a particular log entry to a Caselog attribute. this can be done in PHP.

  1. Get() on an AttributeCaselog returns an ormCaselog object
  2. Use the ormCaselog public method AddLogEntry()
  3. Set back the log on the current object
  4. Ensure that this object change is made persistent with $this→DBUpdate(). In this Prefill example, it's not needed.
class:UserRequest
public function PrefillTransitionForm(&$aContextParam)
{
    switch ($aContextParam['stimulus']) {
 [...]
        case 'ev_resolve':
             // Get the log, the returned object is an ormCaselog, so an object
             $oLog = $this->Get('public_log');
             // Add an entry to the log, with the text, the label of the person who created that entry, the optional id of the User
             $oLog->AddLogEntry('The text to add to the log<br>With html tag if needed', 'A text description of the User who added this entry', :current_user_id);
             // Set back that modified Log on the current UserRequest
             $this->Set('public_log', $oLog);
             break;
 [...]
    }
}

Similar Tutorials
3_2_0/customization/add-log-entry.txt · Last modified: 2024/09/10 10:25 (external edit)
Back to top
Contact us