User Tools

Site Tools

Translations of this page:

User actions configurator

User actions configurator
Configure user actions to simplify and automate processes. Eg create an incident from a CI.
Object Copier

This extensions aims at improving the end-users productivity. It adds a menu to create an item prefilled with information coming from an existing item.

Amongst the possible usages, you can:

  • Provide a mean to quickly clone CIs (clone all the attributes but still force the user to enter a new name)
  • Provide a shortcut to create a ticket from a Contact that will be the caller of the ticket
  • Provide a shortcut to create a parent ticket (and record the information into the child ticket)
  • Provide a shortcut to create a ticket from a CI (and record the information into the child ticket)
  • Provide a shortcut to create a change ticket from a user request (and record the information into the user request)

Let's use the last example to illustrate the possibilities of the module:

Users have a menu in the Other Actions drop-down menu of a User Request:

Clicking on the menu, opens the standard creation form with prepopulated data:

The user can adjust the values, then create the item. In addition to the standard report, a message indicates that something has been retrofitted back to the source item.


A shortcut is governed by a rule definition.

The menu is visible if a series of conditions are met:

  • The item being visited is in the scope of the rule (given by an OQL). For instance, you may want to propose the shortcut only for user request being assigned or pending: SELECT UserRequest WHERE status IN ('assigned', 'pending')
  • The current user has a profile allowed for the rule (can be anybody)

Several rules can coexist for a single source object: there will be as many menus as there are rules that match the conditions.

A rule defines which kind of object to create:

  • Either a given class (can be an abstract class, the user will have to select a subclass)
  • Or the exact same class as the source object

A rule specifies what has to be done to preset or prepopulate the form. This is done by the mean of actions. The following kind of actions are available:

  • Set the value of an attribute depending on the value of one or several attributes from the source object.
  • Copy the N-N links
  • Add an N-N link to the source object or to an external key of the source object.

Additionaly, the rule specifies what has to be done to retrofit some information from the created object to the source object.


The following types of attributes are currently not handled and therefore cannot be preset (and no error message is given):

  • 1-N links (e.g. Server Interfaces)
  • Attachments
  • Blobs
  • Stop watches

Using apply_stimulus() on the created object does not work. If used in preset, the form is shown with the object id and the relevant buttons depending on the new state but then it fails to “create” the object because it was created already during the stimuli processing



Revision History

Version Release Date Comments
1.1.9 2017-11-13 Fix error displayed in error message or tooltip, about read-only attributes being set.
1.1.8 2017-09-29 Showing action in object details only when target class is writable.
1.1.7 2017-04-04 Case logs : when using set on a case log, the entry was set twice, the HTML formatting was lost, and if the log was first copied from the source, it was broken.
1.1.6 2017-03-27 With some customizations (preset on ticket dates), the refresh of dependent fields was broken. Regression introduced in iTop 2.3
1.1.5 2017-03-23 Fix for XSS vulnerability.
1.1.4 2016-08-09 Fix for compatibility with iTop 2.3.0 (still backward compatible): properly handle the breadcrumb + bug fix when using hidden fields and case logs.
1.1.3 2015-10-05 Fix for compatibility with iTop 2.2.0 (still backward compatible)
1.1.2 2015-09-30 New verb: nullify. Useful for leaving a date or datetime undefined (differs from the verb reset because the default value for such attributes is “now”)
1.1.1 2015-07-01 New verb: call_method. Allows any kind of modification on the target object (and/or the source object)
1.1.0 2015-02-03 Added placeholders $current_date$ and $current_time$. Added the verb apply_stimulus. Exposed some APIs to allow the reuse of actions in other modules like itop-stencils
1.0.3 2014-12-18 Translated the default configuration in french (while keeping the engish version as the default)
1.0.2 2014-07-18 Added placeholders for set() and append(): $current_contact_id$ (already documented) and $current_contact_friendlyname$ (new!)
1.0.1 2014-04-03 Fixes an issue with linksets: the links were correctly created into the clone, but they were deleted from the source object
1.0.0 2014-03-04 First officialy released version


Copy the folder itop-object-copier into the extensions folder of iTop and launch the setup again.

Make sure that the web server has enough rights to read the content of the extensions folder and all its sub-folders before launching the setup

When prompted to select the extensions to install, check “Object copier” in the list of available extensions.


Setting name Description Example
source_scope The OQL to define the source objects. The only parameter available is current_contact_id “SELECT UserRequest WHERE status = 'assigned'”
allowed_profiles CSV list of profiles allowing the shortcut. The user must have at least one profile to have the shortcut available. Wrong profiles names are ignored. Set as an empty string to allow the shortcut to anybody. “Administrator,Support Agent”
menu_label Optional: Label or dictionary entry for the new menu entry. It is optional and defaults to “Clone…”
form_label Optional: Label or dictionary entry for the form header. It is optional and defaults to “Cloning %1$s”
report_label Optional: Label or dictionary entry for the report once the object has been created. It is optional and defaults to “Cloned from %1$s”
dest_class Class of the object to create. If empty, it defaults to the class of the source object “Change”
preset Array of actions to preset the object in the creation form. More information below. array()
retrofit Array of actions to retrofit some information from the created object to the source object. More information below. array()

menu_label, form_label and report_label can be localized without the burden of create dictionaries. To do so, create the settings menu_label/<language_code> (e.g. “menu_label/FR FR”) for each supported language. The setting menu_label will be the default value.


An action is specified as a string formatted as verb(arg1[,arg2[…]])
The same action can be requested multiple times.

The following verbs are available:

Verb Parameters Description
clone_scalars <none> Copy all the scalar attributes
clone attcode1,attcode2, … Copy the given attributes
reset attcode Reset the attribute to its default value
nullify attcode New in 1.1.2 - Reset the attribute to its null value (will appear to be undefined from the end users perspective)
copy att_to_read,att_to_write Copy from att_to_read to att_to_write
append attcode,string Append the string to the attribute. The string can contain placeholder like $this->attcode$ (or $current_contact_id$, $current_contact_friendlyname$, $current_date$, $current_time$). Commas must be escaped with a backslash. Newlines (\n) are allowed. The character set must be utf-8.
set attcode,value Set a value. If the value is a string, it can then contain placeholder like $this->attcode$ (or $current_contact_id$, $current_contact_friendlyname$, $current_date$, $current_time$). Commas must be escaped with a backslash. Newlines (\n) are allowed. The character set must be utf-8.
add_to_list attRead,attWrite,attLink,value attRead is an external key on the read object, attWrite is a N-N link set on the written object, attLink is an attribute on the link class that will be set to <value>
apply_stimulus stimulus code Applies the given stimulus (saves the object). To be used in retrofit ONLY. Best practice: It is strongly recommanded to set transition mandatory fields as well, otherwise they will stay empty and could break reporting.
call_method function name New in 1.1.1 - Calls the provided method on the written object. Its prototype must be “public function xxxx($oSource)”. The function can send exceptions in case of failure. In such a case, the error message gets displayed in the log/error.log file

Configuration example

'itop-object-copier' => array(
	'rules' => array(
			'source_scope' => 'SELECT UserRequest WHERE status IN ("assigned", "pending")',
			'allowed_profiles' => 'Administrator,Support Agent',
			'menu_label' => 'Issue a change ticket...',
			'form_label' => 'Issue a change from request %1$s. Please review the description before create the change ticket. After creation of the change ticket, the request ticket will be automatically updated.',
			'report_label' => 'Issued from the request %1$s. The request has been updated.',
			'dest_class' => 'Change',
			'preset' => array(
				'set(description,Original description:\n\$this->description\$)',
			'retrofit' => array(
				'copy(id, parent_change_id)',
				'set(private_log,Issued change $this->ref$)',
			'source_scope' => 'SELECT FunctionalCI',
			'allowed_profiles' => '',
			'dest_class' => '',
			'preset' => array(
			'retrofit' => array(


All errors are logged to the file log/error.log

The behavior from the end-user perspective is:

  • When the parameters source_scope is wrong, the rule is ignored
  • When dest_class is not a valid class, the rule is ignored
  • When source_scope/dest_class/allowed_profiles/preset/retrofit are missing, the rule is ignored
  • When the list of profiles contain wrong names, those names are simply ignored, and if all the names in the list are wrong then no one will have the menu to clone the object.
  • When a preset action is wrong (syntaxically or grammatically), the preset is stopped at that point, the form is displayed with a message explaining the issue: “An error has been encountered while presetting the object to create: <error message>. Please contact your administrator.” The user can proceed with the object creation.
  • When a retrofit action is wrong, the retrofit is stopped at that point, the operation completes (object created as expected) and the report contains: “An error has been encountered while retrofitting some information back to the source object: <error message>. Please contact your administrator.”
extensions/itop-object-copier.txt · Last modified: 2017/11/16 16:07 (external edit)