You are browsing the documentation for iTop 3.0 which is not the current version.

Consider browsing to iTop 3.2 documentation

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_0_0/customization/add-log-entry.txt · Last modified: 2023/03/10 16:05 by 127.0.0.1
Back to top
Contact us