:: 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.
-
Get() on an AttributeCaselog returns an ormCaselog object
-
Use the ormCaselog public method AddLogEntry()
-
Set back the log on the current object
-
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; [...] } }
3_2_0/customization/add-log-entry.txt · Last modified:
2024/09/10 10:25 (external edit)