Creating an INC/Incident ticket in BMC ITSM using powershell

by Grzegorz Kulikowski

this time we will create an ITSM INC ticket using the HPD_IncidentInterface_Create_WS web service.
I assume that from previous posts you already know how to consume this webservice from powershell (post1,post2)
Let’s start our session first:
[sourcecode language=”powershell”]
$myitsm=New-WebServiceProxy -Uri http://itsm.midtier.lan/arsys/WSDL/public/itsm.midtier.lan/HPD_IncidentInterface_Create_WS -Namespace ITSM
$auth= New-Object ITSM.AuthenticationInfo
#you can also just simply use: $passwd=’mysecretpasswordformyitsmuser’
$passwd= get-content C:\passwdforouruser.txt | convertto-securestring
At this point we can start creating our incident ticket in ITSM using HelpDesk_Submit_Service method from $itsm web service object.
Let’s first read what is required to be sent, by the way, it is required to fill out all arguments. I saw a lot of posts on bmc communities that people had issues because they have missed some field. When building arguments for this method it might be little complicated, because of the number of them. In my case i had to fill out 60 arguments. It might be different for your environment i suppose. Lets inspect the method first:
[sourcecode language=”powershell”]
string HelpDesk_Submit_Service(string[] Assigned_Group, string Assigned_Group_Shift_Name, string Assigned_Support_Company, string Assigned_Support_Organization, string Assignee, string
Categorization_Tier_1, string Categorization_Tier_2, string Categorization_Tier_3, string CI_Name, string Closure_Manufacturer, string Closure_Product_Category_Tier1, string
Closure_Product_Category_Tier2, string Closure_Product_Category_Tier3, string Closure_Product_Model_Version, string Closure_Product_Name, string Department, string First_Name,
System.Nullable[ITSM.ImpactType][] Impact, string Last_Name, string Lookup_Keyword, string Manufacturer, string Product_Categorization_Tier_1, string Product_Categorization_Tier_2, string
Product_Categorization_Tier_3, string Product_Model_Version, string Product_Name, System.Nullable[ITSM.Reported_SourceType] Reported_Source, string Resolution, string Resolution_Category_Tier_1,
string Resolution_Category_Tier_2, string Resolution_Category_Tier_3, System.Nullable[ITSM.Service_TypeType] Service_Type, ITSM.StatusType[] Status, string Action,
System.Nullable[ITSM.Create_RequestType] Create_Request, string Summary, string Notes, System.Nullable[ITSM.UrgencyType][] Urgency, string Work_Info_Summary, string Work_Info_Notes,
System.Nullable[ITSM.Work_Info_TypeType] Work_Info_Type, System.Nullable[datetime][] Work_Info_Date, System.Nullable[ITSM.Work_Info_SourceType] Work_Info_Source,
System.Nullable[ITSM.Create_RequestType] Work_Info_Locked, System.Nullable[ITSM.Work_Info_View_AccessType] Work_Info_View_Access, string[] Middle_Initial, System.Nullable[ITSM.Status_ReasonType]
Status_Reason, string Direct_Contact_First_Name, string Direct_Contact_Middle_Initial, string Direct_Contact_Last_Name, string TemplateID, string ServiceCI, string ServiceCI_ReconID, string HPD_CI,
string HPD_CI_ReconID, string HPD_CI_FormName, string WorkInfoAttachment1Name, byte[] WorkInfoAttachment1Data, int WorkInfoAttachment1OrigSize, bool WorkInfoAttachment1OrigSizeSpecified)
Now… it’s really hard to see anything in here… Let’s make it more human readable
[sourcecode language=”powershell”]
$myitsm.HelpDesk_Submit_Service -split ‘,’
string HelpDesk_Submit_Service(
string[] Assigned_Group
string Assigned_Group_Shift_Name
string Assigned_Support_Company
string Assigned_Support_Organization
string Assignee
string Categorization_Tier_1
string Categorization_Tier_2
string Categorization_Tier_3
string CI_Name
string Closure_Manufacturer
string Closure_Product_Category_Tier1
string Closure_Product_Category_Tier2
string Closure_Product_Category_Tier3
string Closure_Product_Model_Version
string Closure_Product_Name
string Department
string First_Name
System.Nullable[ITSM.ImpactType][] Impact
string Last_Name
string Lookup_Keyword
string Manufacturer
string Product_Categorization_Tier_1
string Product_Categorization_Tier_2
string Product_Categorization_Tier_3
string Product_Model_Version
string Product_Name
System.Nullable[ITSM.Reported_SourceType] Reported_Source
string Resolution
string Resolution_Category_Tier_1
string Resolution_Category_Tier_2
string Resolution_Category_Tier_3
System.Nullable[ITSM.Service_TypeType] Service_Type
ITSM.StatusType[] Status
string Action
System.Nullable[ITSM.Create_RequestType] Create_Request
string Summary
string Notes
System.Nullable[ITSM.UrgencyType][] Urgency
string Work_Info_Summary
string Work_Info_Notes
System.Nullable[ITSM.Work_Info_TypeType] Work_Info_Type
System.Nullable[datetime][] Work_Info_Date
System.Nullable[ITSM.Work_Info_SourceType] Work_Info_Source
System.Nullable[ITSM.Create_RequestType] Work_Info_Locked
System.Nullable[ITSM.Work_Info_View_AccessType] Work_Info_View_Access
string[] Middle_Initial
System.Nullable[ITSM.Status_ReasonType] Status_Reason
string Direct_Contact_First_Name
string Direct_Contact_Middle_Initial
string Direct_Contact_Last_Name
string TemplateID
string ServiceCI
string ServiceCI_ReconID
string HPD_CI
string HPD_CI_ReconID
string HPD_CI_FormName
string WorkInfoAttachment1Name
byte[] WorkInfoAttachment1Data
int WorkInfoAttachment1OrigSize
bool WorkInfoAttachment1OrigSizeSpecified)
Little bit better 😉 Few reminders here, when you will fill this out, make sure you stick to proper type as well. If it is required to type a string for property X we type ‘some value’. If it is required to give values for Reported_Source we need to make sure that we are giving the proper type of reported source like in this example :
[sourcecode language=”powershell”]
So if we will be giving this argument we will be giving it as : methodX(arg1,arg2,[ITSM.Reported_SourceType]’Phone’,argN) for example.
Again i would recommend checking bmc communities in case of issues while doing this, i found there a lot of great tips and documents, links are mentioned in previous post. A must see is document written by Carl Wilson (Using BMC ITSM OOB Web Services.doc (check links section in previous posts). I had to type bit more in my case, but i guess everybody might have to fill out his arguments in a little different way.Anyway…
For me the best way for first time to fill out arguments was to create a spreadsheet document with 2 colums, in first i have the definition in second i type my values. It looks like this:
itsm powershell
We can fill it out now with less chance on making an error by putting value in wrong place. In my case i could not create an INC ticket without filling out the HPD_CI/HPD_CI_RecondID,ServiceCI,ServiceCI_RecondID. In order to fill this out you need to take a look at existing INC ticket, if you want to make a ticket like that just copy those values. In previous post i wrote how to query INC tickets so now we just need to take value from it.
[sourcecode language=”powershell”]
Incident_Number HPD_CI_ReconID
————— ————–
Now when copying those values for HPD_CI_ReconID for example, they are unique for a kind of INC ticket. So if you want to make a ticket that looks like existing ticket Z in your itsm, then just copy values from his properties. Those values are not the same for all kinds of tickets. I have created myself 5 identical tickets with different summaries/descriptions, they all had the same HPD_CI_ReconID. Same goes for ServiceCI/ServiceCI_ReconID. Please have in mind that i don’t have any administrative knowledge of itsm, i’m just end user. Please correct me in comments if i write something here which is not true. All of this was created by making hundreds of attempts via powershell/soap ui.

Also the easiest way just to create a look a like ticket is first to grab him and inspect via powershell so you know which values to put in the request method.
Below is the code for HelpDesk_Submit_Service that i have used for creating simple INC ticket. It has a variable inside $date, which is $date=get-date
[sourcecode language=”powershell”]
‘Grzegorz Kulikowski’,
‘Server Hardware’,
‘Mega Services’,
‘Server Hardware’,
‘Notes from test ticket’,
‘Created from Psapp’,
‘Notes in notes’,
‘Infrastructure Services’,
‘Server Hardware’,

If you will execute this method in return you will get a INCnumber of the ticket that you have created.
In the response we get the INC ticket number. In this picture i just cut out the code as it would be too big ;).

Some other things, when you create the ticket like i do here, you will notice that i am putting it to In progress state, as i can’t put it in new for myself as myself, it can be either in pending or in progress. That should not be the problem if you would not assign it to anybody or to somebody else than you. If you get stuck i recommend to write this in soap ui. Links that might be useful :

Below you can check the body of soap request that i have used to create an INC ticket.
[sourcecode language=”powershell”]
<!–1 or more repetitions:–>
<urn:CI_Name>Server Hardware</urn:CI_Name>
<urn:Department>MEGA Services</urn:Department>
<!–1 or more repetitions:–>
<urn:Product_Categorization_Tier_2>Server Hardware</urn:Product_Categorization_Tier_2>
<urn:Service_Type>Infrastructure Restoration</urn:Service_Type>
<!–1 or more repetitions:–>
<urn:Summary>Test Summary</urn:Summary>
<urn:Notes>Test Notes</urn:Notes>
<!–1 or more repetitions:–>
<!–1 or more repetitions:–>
<!–1 or more repetitions:–>
<urn:ServiceCI>Infrastructure Services</urn:ServiceCI>
<urn:ServiceCI_ReconID>—I have copied this value from existing ticket—</urn:ServiceCI_ReconID>
<urn:HPD_CI>Server Hardware</urn:HPD_CI>
<urn:HPD_CI_ReconID>—I have copied this value from existing ticket—</urn:HPD_CI_ReconID>
Don’t forget to fill out the authentication bit :
[sourcecode language=”powershell”]
Ideally in response in SoapUI you should get something similar to this:
[sourcecode language=”powershell”]
<ns0:HelpDesk_Submit_ServiceResponse xmlns:ns0="urn:HPD_IncidentInterface_Create_WS">
One more thing about the soap request. Make sure that you put the values in some fields as you see them in webform and not how powershell is returning them. An example here would be :
We have to type it as ‘4-Low’ and not [ITSM.UrgencyType]—>’Item4Low’, or ‘4-Minor/Localized’ and not [ITSM.ImpactType]—>’Item4MinorLocalized’, like we typed when we were doing this via powershell.

I hope this post will help you to start creating incident tickets in ITSM from powershell using its webservices. If anything is unclear let me know, although like i have mentioned earlier i am no itsm specialist.

You may also like


John McCabe January 28, 2014 - 9:43 pm

ARGH!!! I needed this 36hours ago! 🙂 but excellent post as it is exactly right… fair play!

BTW this works also for the cloud service BMC OnDemand ITSM

so great work!

psvmware January 28, 2014 - 10:16 pm

😉 Thanks John

Adam February 13, 2014 - 12:13 pm

cheers dude helped me out alot here.

chitransh October 27, 2016 - 6:07 pm

The contact for the creation of an Incident
cannot be found, please verify the contact information and try again

chitransh October 27, 2016 - 6:09 pm

I am getting this error. Please help anyone.


Leave a Reply

Chinese (Simplified)EnglishFrenchGermanHindiPolishSpanish
Streaming live on Twitch right now.