Skip navigation

Digital Workplace

1 Post authored by: Carl Wilson Champion
Share This:

Creating and Updating a ITSM Application Request using Service Broker Workflow

 

Service Broker leverages a Workflow Designer to interact with third party applications including Remedy ITSM providing the ability to create Incidents, Changes and Work Orders.

It also provides the ability to update, query and delete entries using the Set Entry, Get Entry and Delete Entry Activities - however these Activities are currently limited to performing a lookup based on a Entry / Request ID only.

 

Question: One of the use cases that may appear is how do I create a Work Order and then update the newly created Work Order with values when I only have basic information returned from each Activity?

 

Answer:  We need to put on our "Remedy ITSM Administrator" hat to understand what occurs during the creation of a request via the ITSM "Interface_Create" forms that Service Broker leverages.

 

The following steps occur when a request is created via Service Broker, and is the same process followed if creating a request via a third-party interface:

 

  1. Values are pushed into the applications "Interface_Create" form.
  2. Workflow generates the Application Number e.g. Incident Number, Change Number, Work Order Number.
  3. Workflow validates the information and performs all necessary lookup to retrieve the required information.
  4. If successful, the Entry ID [Field ID 1] of the "Interface_Create" record is returned in the transaction.  Note: This is not the workflow generated Application Number.

 

To obtain the actual underlying Application Number generated (Incident Number, Change Number, Work Order Number), we need to perform a query back against the "Interface_Create" record using the Entry ID obtained from step 4.

 

This is standard integration functionality for Remedy ITSM that has existed since the 7.x versions.

 

Question: How do we obtain the necessary ID's then use these to query and update existing records?

 

Answer: There are a number of methods that can be utilised, below is one method for Work Orders. The same principles apply across the ITSM applications.  It is recommended during testing to check the returned values using the "Send In App Notification" Activity.

 

Method One:

 

Create Update Work Order.PNG

 

The following lists the steps for the workflow above:

 

1.  Create the Remedy Work Order using the "Create Remedy Work Order" Activity.  This returns the "Interface Create Entry ID" [Field ID 1] as the Output.  This can be placed into a local parameter (for reuse), or you can use the Output from this Activity directly into the Input of the "Get Entry".

2.  Using a "Get Entry" Activity we query the "WOI:WorkOrderInterface_Create" record, by the Output obtained in the previous step, to obtain a list of values from the Interface_Create record.

          Get Entry Input.png

  • The Output for the Get Entry Activity is actually a Map (list) of key-value pairs (fields/values) from the underlying Remedy record.
  • If looking at the actual underlying code involved in the lookup, it looks something like this:

 

public Map<String, Object> getEntry(RemedyConnection connection, String formName, String entryId)

{

Entry entry = this.arApiManager.getEntryByEntryId(connection, formName, entryId);

FormFieldMapping formFieldMapping = getFormFieldMapping(connection, formName);

Map entryMap = getEntryMap(formFieldMapping, entry);

return entryMap;

}

 

  • As can be seen (semantics aside), the Output of the Get Entry is actually a "Map" of all the values from the form (formName) used in the Get Entry Java call to the ITSM Remedy application (the 9.x version of Remedy utilises the Java API -  which is what the Service Broker implementation is based on)
  • If you assign the Output to a local parameter, you can obtain the full process JSON string ID for the Output of this Activity that we use in the next steps to extract the key-value pair information, utilising the "Map" containing the result.

        Example - Output mapped to a local variable in the Get Entry Activity:

          Get Entry Output 2.png

  • By looking at the JSON representation of the Process [Clicking on the "{}JSON" button next to "Save" in the Designer], we can obtain the ID for the Output parameter that we will utilise in the next step.  In this case we are looking for the Get Entry Activity within the JSON string (snippet below).  As can be seen below, by allocating the Output to a local parameter in the Get Entry Output Map, we see the full JSON string representation of the Output parameter from the Activity.

 

{

      "resourceType": "com.bmc.arsys.rx.services.process.domain.ServiceTaskDefinition",

      "version": null,

      "lastUpdateTime": "2017-04-04T17:10:27.934+0000",

      "lastChangedBy": "Allen",

      "owner": "Allen",

      "name": "Get Entry",

      "tags": null,

      "description": "",

      "overlayGroupId": null,

      "guid": "rx-250ebb40-cb9b-4434-9dd2-462974e0bae0",

      "multiInstanceLoopDefinition": null,

      "actionTypeName": "com.bmc.myservice.connect.remedy:getEntry",

      "inputMap": [],

      "outputMap": [

        {

          "assignTarget": "Work Order Id",

          "expression": "${activityResults.rx-250ebb40-cb9b-4434-9dd2-462974e0bae0.output}"

        }

      ],

      "runAsUser": null,

      "label": "Get Entry"

    }

 

3.  Once we have the above JSON representation for the Get Entry Output parameter, we can use this to obtain the individual key-pair values by the "Key".  The "Key" represents the name of the Field on the ITSM Remedy form.  To obtain the "WorkOrder_ID", we need to use the above JSON string along with the "Key" to extract the value.

To do this, we add in the "Key" to the JSON string inside the brackets as follows:

 

${activityResults.rx-250ebb40-cb9b-4434-9dd2-462974e0bae0.output.WorkOrderID}

 

We can now copy the above string into a local parameter (Output Map Parameter) or an input to the next Activity.

 

The Workflow will display an error, this is due to the Workflow Designer not being able to resolve the expression to internal expression ("icon/parameter"), although it is valid JSON.  You can safely ignore this error (BMC are working on a fix for this behaviour).

 

 

Additional values can be obtained from the output parameter by using the name of the Field in Remedy (Database Name) for the target form specified in the Get Entry Activity.

Examples:

 

${activityResults.rx-250ebb40-cb9b-4434-9dd2-462974e0bae0.output.WorkOrderID}

${activityResults.rx-250ebb40-cb9b-4434-9dd2-462974e0bae0.output.Status}

${activityResults.rx-250ebb40-cb9b-4434-9dd2-462974e0bae0.output.Person ID}

${activityResults.rx-250ebb40-cb9b-4434-9dd2-462974e0bae0.output.Customer Person ID}

${activityResults.rx-250ebb40-cb9b-4434-9dd2-462974e0bae0.output.Site}

${activityResults.rx-250ebb40-cb9b-4434-9dd2-462974e0bae0.output.Detailed Description}

 

4.  Using the "Get Remedy Work Order By Id" Activity, we can obtain parameterised Output values which can be used in the next Activity.  The Output for this Activity has been broken out into the most commonly used parameters by BMC.

** Alternately you could use the same method above with the "Get Entry" to obtain values for any particular form, but you would need to know the Request / Entry ID [Field 1] for the record you want to retrieve the values from **

 

 

The above shows the "Request Id" Output parameter from the "Get Remedy Work Order By Id" Activity being used as the "Request Id" input value for a "Set Entry" Activity.

If you check the generated JSON for the Activity, you will see what the "Request Id" Output parameter is known as internally to the Service Broker workflow (you should now start notice the pattern between the internal representation of a parameter, and the "displayed" value in the UI Design"):

 

    {

      "resourceType": "com.bmc.arsys.rx.services.process.domain.ServiceTaskDefinition",

      "version": null,

      "lastUpdateTime": "2017-04-04T20:09:06.952+0000",

      "lastChangedBy": "Allen",

      "owner": "Allen",

      "name": "Set Entry",

      "tags": null,

      "description": "",

      "overlayGroupId": null,

      "guid": "rx-ddd6e18b-90c9-4c3c-bf9b-ea552e94d617",

      "multiInstanceLoopDefinition": null,

      "actionTypeName": "com.bmc.myservice.connect.remedy:setEntry",

      "inputMap": [

        {

          "assignTarget": "connectionId",

          "expression": "\"8aef2088-98f8-43fb-9ea6-4f4585070ce6\""

        },

        {

          "assignTarget": "requestId",

          "expression": "${activityResults.rx-a21dee9b-3c0c-4067-bf10-c6e3480897ef.requestId}"

        }

      ],

      "outputMap": [],

      "runAsUser": null,

      "label": "Set Entry"

    }

 

5.  Once we have the "Request Id", we can use the value in the "Set Entry" Activity for the "Request Id" input.

 

 

  • We also need to build an "Input Map" containing the key-pair values we want to pass into the "Set Entry" Activity.  The "Key" again represents the Field Name [Database Name] for the form we intend to update, the "Value" the information we are pushing to the field.

 

  • We then associate the Input Map to the "Set Entry" Field Values Input.

 

6.  We can finish of the process with a "Receive Task" Activity to wait for the Completion of the request.

 

 

Putting it all together without the Notifications, will look something similar to this:

 

 

Which performs:  Create Work Order, return Interface_Create Entry ID > Get Work Order Number from the Work Order Interface Create ("WOI:WorkOrderInterface_Create") form > Get Work Order Entry ID (Request Id) from the Work Order ("WOI:WorkOrder") form > Update Work Order (WOI:WorkOrder) with required values > Wait for Work Order completion

 

Conclusion

 

This demonstrates using the OOB provided activities to create and update the Work Order.  The same principles can be applied to the Incident and Change Management, and if wanting to update multiple times throughout a process workflow then it is recommended to store the ID's required in a local variable that can be reused.

 

Currently there is no OOB Activity in Service Broker to perform a query based lookup against a form in ITSM Remedy, so you will need to know the Entry / Request ID of the forms that you need to pull information back from or push information into.

Filter Blog

By date:
By tag: