Create Incident ticket in BMC Remedy via Java API

December 14th, 2009 by Venkat Leave a reply »

/* This creates an entry in the form HPD:Help Desk, returns the Entry ID (not Incident Number) to the command line */

import com.bmc.arsys.api.*;

public class CreateEntry {

public static void main(String[] args) {

//Initialize a new ARServerUser object, this is the main object we are using for all actions

// for e.g. user=Demo, password=pwd, server=remedy, port=7100

ARServerUser context = new ARServerUser(“Demo”, “pwd”, “”, “”,”remedy”,7100);

//A new entry we want to submit into remedy

Entry newEntry = new Entry();

//put the field values in there. (Integer fieldID, Value of field)

newEntry.put(7, new Value(0)); // Status
newEntry.put(8, new Value(“This record is created via Java API”)); // Short Description
newEntry.put(1000000163, new Value(4000)); // Impact – (High) 1000/2000/3000/4000 (Low)
newEntry.put(1000000162, new Value(4000)); // Urgency – (High) 1000/2000/3000/4000 (Low)
newEntry.put(1000000000, new Value(“xyz”)); // Description
newEntry.put(1000000151, new Value(“xyz”)); // Details
newEntry.put(1000000099, new Value(0)); // Service Type – 0/1/2/3
newEntry.put(240001002, new Value(“xyz”)); // Product Name
newEntry.put(200000003, new Value(“xyz”)); // Product Cat Tier 1
newEntry.put(240001002, new Value(“xyz”)); // Product Cat Tier 2
newEntry.put(200000005, new Value(“xyz”)); // Product Cat Tier 3
newEntry.put(1000000063, new Value(“xyz”)); // Operational Cat Tier 1
newEntry.put(1000000064, new Value(“xyz”)); // Operational Cat Tier 2
newEntry.put(1000000217, new Value(“xyz”)); // Assigned Group
newEntry.put(1000000054, new Value(“xyz”)); // Corporate ID
newEntry.put(2, new Value(“Demo”));

try{

//And here we create the entry itself, printing out the EntryID we get back

String EntryId = context.createEntry(“HPD:Help Desk”, newEntry);

System.out.println(“Request ID = “+EntryId);

}

catch(ARException arException){

arException.printStackTrace();

}

}

}

Thanks to Jason, who originally posted this on Stackoverflow.com

Note: Check the code and do necessary changes where needed. This code itself creates a incident in Remedy 7.1+ versions with required fields filled. This doesn’t get the Incident ID from the ticket created instead gets the Entry ID from the HPD:Incident Management schema.

Advertisement

2 comments

  1. kedar says:

    Thanks a lottt!!

  2. eapmartins says:

    Hi,

    I’ve a question. How can I set the serverName?

    ARServerUser context = new ARServerUser(“Demo”, “pwd”, “”, “”,”remedy”,7100);

    For example, my server is 127.0.0.1:8080/remedy

    So, ARServerUser context = new ARServerUser(“edsonuser”, “edsonpassword”, “”, “”,”http://127.0.0.1:8080/remedy”);

    How to set the port if I’m adding the full path?

    I’ve tried many ways to fix that. Could you please tell me how you created that?

    Thanks a lot.

Dare to share..

%d bloggers like this: