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

Consider browsing to iTop 3.2 documentation

Creator of an object

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:
Querying the UserRequest per creator, storing the result
level:
Medium
domains:
XML, PHP, Relation
min version:
3.0.0

You want to be able to retrieve all the User Requests which have been created by a given user/person

That information is available in the object history, but is not easy to query in OQL and for sure you cannot build a dashboard counting the User Request per creator. So in order to solve that issue, you will have to:

  1. Add a new field creator_id on Ticket or UserRequest, being an ExternalKey to the class Person
  2. Storing automatically the object creator
  3. Retrieve the creator of each past Ticket by querying the history and update the Ticket

Add Ticket::creator_id

For this check Add a field to the Server class

If you decide to display that creator_id field within User Request, Incident, Change,… details, then it might be worse to make it read only

Feed Creator with current user

When the Ticket is created, you want to initiate the creator_id automatically using the person associated to the current user

class::Ticket
protected function OnInsert()
{
        $this->Set('creator_id', UserRights::GetContactId());
        parent::OnInsert();
}

Then run a Setup to make the new field existence effective in your iTop

Data initialization

1) In your iTop 3.0.0+, run that query

SELECT co, p FROM CMDBChangeOp AS co
  JOIN CMDBChange AS c ON co.change=c.id
  JOIN Ticket AS t ON co.objkey=t.id
  JOIN USER AS u ON c.user_id=u.id
  JOIN Person AS p ON u.contactid=p.id
WHERE co.finalclass="CMDBChangeOpCreate"

The fields to keep, returned by the above query are:

  • co.object_id to import into Ticket id (Primary key)
  • p.id (Primary key) to import into Creator

2) Then CSV import in advanced mode, the 2 columns into User Request and Incident

3_0_0/customization/tracking-creator.txt · Last modified: 2022/04/12 18:08 by 127.0.0.1
Back to top
Contact us