:: Version 3.3.0 ::
Change the way parent ticket log entries are copied on child tickets
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.
When an entry is added to a Ticket caselog, a copy of that entry is automatically added on all child Tickets,
-
New in 3.3.0: with a prefix to better identify its origin.
-
New in 3.3.0: with the possibility to copy parent log entries into a different child log
Prefix
-
Those prefix are dictionary entries with 2 placeholders (%1$s is the parent ticket id, %2$s is the parent ticket ref)
-
Dictionary entries reference the parent class and the parent attribute code of the caselog which was modified initially
Dict::Format('Class:'.$sParentClass.'/Method:UpdateChildTicketWith:'.$sParentAttCode, $this->GetKey(), $this->Get('ref');
'Class:UserRequest/Method:UpdateChildTicketWith:public_log' => '<i><u>Public log automatic copy from parent User Request %2$s:</u></i><br><br>', 'Class:UserRequest/Method:UpdateChildTicketWith:private_log' => '<i>Private log automatic copy from parent User Request [[UserRequest:%1$s]]:</i><br><br>',
Those dictionary entries used HTML tags, which are not supported by the Designer, but they can be overwritten by an extension in XML.
Copy a log into another
A new method was added to the Ticket class
- Ticket::UpdateChildTicketLog
-
// @param string $sChildClass The class name of the child ticket (e.g. 'Incident', 'UserRequest', etc.) // @param string $sChildParentAttCode The external key in the child class pointing to the parent ticket (e.g. 'parent_request_id') // @param array $aLogAttCodes An array of parent caselog attribute codes and for each the corresponding child log attribute code to update (e.g. ['public_log' => 'private_log']) // So in the example parent.public_log will be copied into each child.private_log public function UpdateChildTicketLog($sChildClass, $sChildParentAttCode, $aLogAttCodes) {
The method of the UserRequest or Incident which is called to copy the parent log entry into its sub-tickets, can decide to copy only parent public log entries in the private log of the sub-ticket. For this replace this code:
- UserRequest::UpdateChildRequestLog
-
return $this->UpdateChildTicketLog('UserRequest', 'parent_request_id', ['public_log' => 'public_log', 'private_log' => 'private_log'] );
by that one:
- UserRequest::UpdateChildRequestLog
-
return $this->UpdateChildTicketLog('UserRequest', 'parent_request_id', ['public_log' => 'private_log'] );
3_3_0/customization/copy-parent-log.txt ยท Last modified:
2026/07/23 16:11 by 127.0.0.1
