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

Consider browsing to iTop 3.1 documentation

Inherite services from parent organization

Prerequisite: You must be familiar with the Syntax used in Tutorials and have already created an extension.

learning:
Be able to use the Services bought by a parent organization
level:
Intermediate
domains:
XML, Portal
min version:
2.3.0

We want the services to be inherited on child organizations. For this, we need to:

  • Change the list of Services proposed in the Console on UserRequest edition
  • Change the way to retrieve the applicable SLT used to compute TTO and TTR deadline
  • Change the way to retrieve the applicable Coverage Window used to compute TTO and TTR deadline
  • Change the list of Services and Service Subcategories allowed in the Portal

Datamodel

Change 'service_id' filter on class UserRequest and/or Incident

itop-design / classes / class@UserRequest / fields
  <field id="service_id" xsi:type="AttributeExternalKey">
    <filter _delta=”redefine”>
    <![CDATA[
      SELECT Service AS s JOIN lnkCustomerContractToService AS l1 ON l1.service_id=s.id 
      JOIN CustomerContract AS cc ON l1.customercontract_id=cc.id 
      JOIN Organization AS root ON cc.org_id = root.id 
      JOIN Organization AS child ON child.parent_id BELOW root.id 
      WHERE child.id = :this->org_id AND s.status != 'obsolete'  
    ]]>
    </filter>
  </field>

Applicable SLT

Change query for retrieving the applicable SLT

itop-design
  <constants>
    <constant id="RESPONSE_TICKET_SLT_QUERY" xsi:type="string" _delta="redefine"><![CDATA[
SELECT SLT AS slt 
JOIN lnkSLAToSLT AS l1 ON l1.slt_id=slt.id 
JOIN SLA AS sla ON l1.sla_id=sla.id 
JOIN lnkCustomerContractToService AS l2 ON l2.sla_id=sla.id 
JOIN CustomerContract AS sc ON l2.customercontract_id=sc.id 
JOIN Organization AS root ON sc.org_id = root.id 
JOIN Organization AS child ON child.parent_id BELOW root.id 
WHERE slt.metric = :metric AND l2.service_id = :this->service_id 
AND child.id = :this->org_id AND slt.request_type = :request_type 
AND slt.priority = :this->priority
    ]]></constant>
  </constants>

The retrived SLT is used to compute the deadline to own or resolve a particular ticket, in order to stay within the SLA. See this Tutorial for more details: SLA by Service Subcategory

Applicable Coverage Window

We need to change in the Configuration file, the parameter coverage_oql defined in the module combodo-sla-computation. This parameter is an OQL query which retrieve the CoverageWindow applicable for the current Ticket.

Configuration
      'combodo-sla-computation' => array (
                'coverage_oql' => '
                        SELECT CoverageWindow AS cw 
                        JOIN lnkCustomerContractToService AS l1 ON l1.coveragewindow_id = cw.id 
                        JOIN CustomerContract AS cc ON l1.customercontract_id = cc.id 
                        WHERE cc.org_id= :this->org_id 
                        AND l1.service_id = :this->service_id',
                'holidays_oql' => 'SELECT Holiday',
        ),

Replace the OQL with this query

  • Get CustomerContracts from any organization
  • which has an organization below in the organization tree
  • which is the organization of the Ticket
   SELECT CoverageWindow AS cw 
      JOIN lnkCustomerContractToService AS l1 ON l1.coveragewindow_id = cw.id
      JOIN CustomerContract AS cc ON l1.customercontract_id=cc.id 
      JOIN Organization AS root ON cc.org_id=root.id
      JOIN Organization AS child ON child.parent_id BELOW root.id
   WHERE child.id= :this->org_id 
   AND l1.service_id = :this->service_id

Enhanced Portal

The proposed Services and Services Subcategories are limited by the scopes defined in the default portal, so we need to change them, in order for a User Portal to be able to see (and select) any Services bought by the User organization or any of its ascendants.

itop-design / module_designs
   <module_design id="itop-portal" _delta="must_exist">
      ...
      <classes>
        <class id="ServiceFamily" _delta="redefine">
          <scopes>
            <scope id="all">
              <oql_view><![CDATA[SELECT ServiceFamily AS sf 
              JOIN Service AS s ON s.servicefamily_id = sf.id
              JOIN lnkCustomerContractToService AS l1 ON l1.service_id=s.id 
              JOIN CustomerContract AS cc ON l1.customercontract_id=cc.id 
              JOIN Organization AS root ON cc.org_id = root.id 
              JOIN Organization AS child ON child.parent_id BELOW root.id 
              WHERE child.id = :current_contact->org_id AND s.status != 'obsolete']]></oql_view>
              <ignore_silos>true</ignore_silos>
            </scope>
          </scopes>
        </class>
        <class id="Service" _delta="redefine">
          <scopes>
            <scope id="all">
              <oql_view><![CDATA[SELECT Service AS s 
              JOIN lnkCustomerContractToService AS l1 ON l1.service_id=s.id 
              JOIN CustomerContract AS cc ON l1.customercontract_id=cc.id 
              JOIN Organization AS root ON cc.org_id = root.id 
              JOIN Organization AS child ON child.parent_id BELOW root.id 
              WHERE child.id = :current_contact->org_id AND s.status != 'obsolete']]></oql_view>
              <ignore_silos>true</ignore_silos>
            </scope>
          </scopes>
        </class>
        <class id="ServiceSubcategory" _delta="must_exist">
          <scopes>
            <scope id="all" _delta="must_exist">
              <oql_view _delta="redefine"><![CDATA[SELECT ServiceSubcategory AS ss
                JOIN Service AS s ON ss.service_id=s.id
              JOIN lnkCustomerContractToService AS l1 ON l1.service_id=s.id 
              JOIN CustomerContract AS cc ON l1.customercontract_id=cc.id 
              JOIN Organization AS root ON cc.org_id = root.id 
              JOIN Organization AS child ON child.parent_id BELOW root.id 
              WHERE child.id = :current_contact->org_id  AND s.status != 'obsolete']]></oql_view>
            </scope>
          </scopes>
        </class>
 
        ...
      </classes>
      ...
   </module_design>
2_7_0/customization/service-heritage.txt · Last modified: 2022/03/24 15:27 (external edit)
Back to top
Contact us