1.17 ZSD Store Extensions

ZENworks Service Desk (ZSD) has the ability to add the customized store extensions for the auto assignment of store item. In order to implement custom functionality on the assignment state follow:

1.17.1 Building the Extension

Java interface provided in a standalone jar file livetime-listen.jar, and it is available at:{ZSD Installation Folder}/LiveTime.woa/Contents/Resources/Java/ The livetime-listen.jar file contains the ExternalStoreExtension interface, with the following method:

public Map<String, String> statusEntered(Map<String, Object> argsMap) throws Exception; The developer task is to create a java class that implements above interface to achieve the integration objective.The implementing class is required to return a Map. Method that provide functionality should return a map which will be parsed for the following parameters:

  • success: ‘true’ or ‘false

  • message: Description to be stored against the history and note of the store request.

The method is passed a Map of parameters that relate to the store request being updated. ZSD will pass a string for all the values, this method takes for future extensions that might require the use of objects. Implementations should check whether the object is a String prior to casting to future-proof the implementation.

1.17.2 ExternalStoreExtension Arguments

The parameter Map passed in to the ExternalStoreExtension interface method consists:

Parameter

Description

triggerStatusId

ID of the status that has triggered the extension:

  • statusEntered: newStatus

triggerStatusName

Name of the status that triggered the extension.

requestId

ID of the request being updated.

requestType

Type of the request being updated.

  • 7000 = Service Request

statusId

Current state of the request same as assignment state.

statusName

Name of the state defined by statusId above.

classificationId

ID of the classification assigned to the request.

customerId

ID of the customer assigned to the request.

customerFirstName

The first name of the customer assigned to the request.

customerLastName

The last name of the customer assigned to the request.

customerEmail

Email address of the customer assigned to the request.

orgUnitId

ID of the Org Unit associated with the request.

orgUnitName

Name of the Org Unit associated with the request.

itemNumber

Item number of the CI associated with the request.

As this is the first iteration of the call-out interface, these parameters have been deemed sufficient to allow a developer to perform tasks such as update an external system that might require request updates.

1.17.3 Implementing the Store Extension

Requires Java knowledge, to either define the entire functionality, using these entry points, or to create a Java Native Interface (JNI) wrapper to page out to code written in an alternate language, although this does have platform implications. A JNI implementation is outside the scope of this document, and the following sample focuses on a Java Implementation.

The user needs to create a class, for example ‘MyStoreExtensionImpl’ which implements the ExternalStoreExtension interface. Implemented method then needs to be made to perform some work. For example, the extension calls a web service to an external system. Consider the following usage scenario:

package com.microfocus; 

import java.util.HashMap;
import java.util.Map;
import com.novell.store.extension.external.ExternalStoreExtension;

public class BusinessCardExtensionImpl implements ExternalStoreExtension
{
       /**
     * This method will be called at the entry of the state, i.e if workflow has state hierarchy like state1-> Assignment State-> State2 then this will be called on transition of state1 to Assignment State
     * @param argsMap 
     * @return a map. This map must contain 2 entries.
     *         key=message value=A user friendly message summarizing the result of action performed by this extension.
     *         key=success value=true|false in String. this denotes the status of the extension process.
     * @throws Exception
     */
       @Override
     public Map<String, String> statusEntered(Map<String, Object> arg0)
      throws Exception {
    boolean success = doSomething(); // Your actual business logic goes here.
    Map<String, String> response = new HashMap<>(); //This message will be added as part of the Note and Audit Trail. E.g 
    
    if(success)
             response.put("message", "Order for Business card has been successfully placed.");
    else
             response.put("message", "Order for Business card has been failed.");
    
           response.put("success", String.valueOf(success));
    
           return response;
  }

  private boolean doSomething() {
    //
    //Do Something. Invoke external services handling order for business cards.
    //
    boolean success = true;
    return success;
    }
}

1.17.4 Making the Store Extension Available to ZSD

In order for the class to be accessible to ZSD, the compiled code needs to be on the ZSD classpath. In this case, the compiled jar, along with any associated components, need to be copied into the lib folder of the ZSD installation ({ZSD Path}/WEB-INF/lib), and the ZSD instance needs to be restarted, so these resources are picked up by the classloader.

1.17.5 Configuring ZSD to Use the Extension

At this point a new class or classes exist and have been loaded, now ZSD needs to be configured to use them.

  • Enable the Store feature. For information, see Enabling Store.

  • Create the Store Extension. For information, see Creating a Store Extension.

  • Assign the extension to applicable Item Category or Item Type.