The following can be compiled using VS2008 and copied into a new project. The ARAP !.
." was used. #op$ the
following code into a new project and add a reference to the %&#.ARS$stem.dll in the director$ where $ou installed the ARAP. To use the program' suppl$ the re(uired parameters in the cmd line call) consolecreateticket.exe -s itsm7rtm -u Demo -p password -t 0 -f Bob -l Backline * ++ Add a reference to the %&#.ARS$stem.dll file in the Project * References to ,-ternal .dll .iles mports %&# mports S$stem &odule &odule" * Public &odule /eclarations 0A1ailable Throughout &odule2 Public ARSSer1er As 3ew %&#.ARS$stem.Ser1er Public ARSer1er3ame As String Public ARSer1erPort As String Public AR4ser As String Public ARPassword As String * 55 Start of &ain Routine in &odule' #apture nput Parameters Public Sub &ain0%$Val #md6ineArgs02 As String2 * 55 This program will perform the following) * 55 ". #reate a new ncident Re(uest 1ia the 7P/)ncidentnteface8#reate form * 55 2. 9uer$ the 7P/)ncidentnteface8#reate form for ncident 3umber * 55 :. 9uer$ the 7P/)ncidentnteface form for the ,ntr$ / for use with the modif$ function * 55 ;. Send a &odif$ command and parameters the 7P/)ncidentnteface form to #lose the ncident Re(uest
* 55 nput Parameters are) < 55 =s ARSer1er' =u AR4ser' =p ARPassword' =t ARSer1erPort' =f Re(uester.irst3ame' =l Re(uester6ast3ame * 55 ++ Password cannot be blan> ++ * 55 The #reate 4ses Auto Assignment. .ill in the re(uired fields to use manual Assignment. * 55 ,-tra cmd line Parameters will be needed for #ompan$' ?rg' Support @roup if manual assignment re(uired < 55 or the$ can be hardcoded. * 55 AR4ser must be someone with ncident &odif$ permission 0e.g. ncident &aster2 and be in the same Support @roup as Assignment. * 55 /efine the re(uired 1ariables /im ,rr&sg As String A String.,mpt$ /im AR.orm As String A B7P/)ncidentnterface8#reateB /im ntnterface,ntr$/ As String /im strncident/ As String /im str,ntr$/ As String /im strS96 As String /im .ield6ist As 3ew %&#.ARS$stem..ieldValue6ist /im ,ntr$.ield6ist A 3ew %&#.ARS$stem.,ntr$6ist.ield6ist /im ,ntr$.ieldValue6ist A 3ew %&#.ARS$stem.,ntr$.ieldValue6ist /im str.irst3ame As String /im str6ast3ame As String Tr$ * 55 ,-tract parameters from cmd line. ARSer1er3ame A @etArgValue0#md6ineArgs' B=sB' ,rr&sg2 AR4ser A @etArgValue0#md6ineArgs' B=uB' ,rr&sg2 ARPassword A @etArgValue0#md6ineArgs' B=pB' ,rr&sg2 ARSer1erPort A @etArgValue0#md6ineArgs' B=tB' ,rr&sg2 str.irst3ame A @etArgValue0#md6ineArgs' B=fB' ,rr&sg2 str6ast3ame A @etArgValue0#md6ineArgs' B=lB' ,rr&sg2 * %elow is the list of &inimum .ields Re(uired b$ 7P/)ncidentnterface8#reate to create an ,ntr$ in 7P/)7elp/es> * ++ 3ote = Auto Assignment Rule needed on ncident form' else $ou need to populate the following .ields) ++ * Support #ompan$+ * Support ?rganiCation+ * Support @roup+ * Assigned @roup Shift 3ame * Assignee * 6ogin / for Assignee .ield6ist.Add0"0000000!D' B#R,AT,B2 * 55 Ee$word Triggers the #reate .ield6ist.Add0"0000000"8' str6ast3ame2 * 55 6ast83ame .ield6ist.Add0"0000000"F' str.irst3ame2 * 55 .irst83ame .ield6ist.Add0!' "2 * 55 Status .ield6ist.Add0"0000000FF' :2 * 55 Ser1ice8T$pe .ield6ist.Add0"000000"D:' ;0002 * 55 mpact .ield6ist.Add0"000000"D2' ;0002 * 55 4rgenc$ .ield6ist.Add0"000000000' BRemed$ Test Tic>et .rom APB2 * 55 /escription .ield6ist.Add0"0000002"G' "00002 * 55 Reported Source * 55 ?ptional for SR& Re(uest #reation *.ield6ist.Add0:0"D!;D00' BHesB2 *55 .lag8#reate8Re(uest = Re(uired to create SR& Re(uest ,ntr$ * 55 ++ #all 6ogin .unction within ARS7elper #lass ++ ARSSer1er A ARSnitialise.6ogin * 55 ++ #reate the ,ntr$ in 7P/)ncidentnterface8#reate with abo1e .ield 6ist ++ * 55 ++ Returns the Re(uest / 0.ield / "2 from the 7P/)ncidentnterface8#reate .orm ++ ntnterface,ntr$/ A ARSSer1er.#reate,ntr$0AR.orm' .ield6ist2 * 55 ++ #reate S96 9uer$ for @et6ist,ntr$Iith.ields ðod ++ * 55 Ie are wanting to use the / returned in the #reate abo1e = this is our reference * 55 + ,-ample 9uer$ + * 55 e.g. strS96 A B*"* A B J B0000000000000DB strS96 A B*"* A B J ntnterface,ntr$/ * 55 Add The .ield0s2 Ie Iant To %ring %ac> .rom The .orm to the ,ntr$ .ield 6ist to parse in the method * 55 e.g. ncident 3umber ,ntr$.ield6ist.Add.ield0"000000"D"2 *55ncident 3umber *,ntr$.ield6ist.Add.ield0"000000GD02 *55Reported /ate+ *,ntr$.ield6ist.Add.ield0:0"G!2"002 *55SR/ *,ntr$.ield6ist.Add.ield0"0000000822 *55#ontact #ompan$+ *,ntr$.ield6ist.Add.ield0"000000"D;2 *55Priorit$ * 55 ++ Return the ncident /+ from the call ,ntr$.ieldValue6ist A ARSSer1er.@et6ist,ntr$Iith.ields0B7P/)ncidentnterface8#reateB' strS96' ,ntr$.ield6ist' 0' G02 strncident/ A BB * 55 f returning more than one entr$' use a for loop .or ,ach entr$.ieldValue n ,ntr$.ieldValue6ist strncident/ A entr$.ieldValue..ieldValues0"000000"D"2 #onsole.Irite0Bncident /+ A B2 #onsole.Irite6ine0entr$.ieldValue..ieldValues0"000000"D"22 3e-t * 55 3?T,) 9uer$ re(uired for 7P/)ncidentnterface differs from abo1e as we are specif$ing a particular field b$ name * 55 ,-ample S96 9uer$ ++ 3ote) n1erted #ommas 3eeded or S96 Iill .ail++ * 55 strS96 A B*ncident 3umber* A BB3#0000000000F:BBB strS96 A B*ncident 3umber* A BBB K strncident/ K BBBB * 55 Retrie1e Re(uired ,ntr$ / from 7P/)ncidentnterface for &odif$ 0#lose2 Action ,ntr$.ield6ist.#lear02 ,ntr$.ield6ist.Add.ield0"2 *55,ntr$ / ,ntr$.ieldValue6ist A ARSSer1er.@et6ist,ntr$Iith.ields0B7P/)7elp /es>B' strS96' ,ntr$.ield6ist' 0' "2 str,ntr$/ A BB .or ,ach entr$.ieldValue n ,ntr$.ieldValue6ist str,ntr$/ A entr$.ieldValue..ieldValues0"2 #onsole.Irite0B,ntr$/ A B2 #onsole.Irite6ine0entr$.ieldValue..ieldValues0"22 3e-t * 55 #lose ?ut the ncident b$ suppl$ing Resolution' Status' Status Reason and Assignee information * 55 Assignee information is re(uired on different setups' so best to include it for safet$ .ield6ist.#lear02 .ield6ist.Add0"0000000!D' B&?/.HB2 * 55 Ee$word Triggers the &odif$ .ield6ist.Add0"000000"GD' BAP Automatic ResolutionB2 * 55 Resolution .ield6ist.Add0"000000"G0' B3o .urther Action Re(uiredB2 * 55 Status Reason .ield6ist.Add0!' B#losedB2 * 55 Status .ield6ist.Add0"0000002"8' 0str.irst3ame J B B J str6ast3ame22 * 55 Asignee .ield6ist.Add0;' AR4ser2 * 55 6ogin / of Assignee strS96 A str,ntr$/ * 55 ,ntr$ / of 7P/)ncidentnterface ARSSer1er.Set,ntr$0B7P/)ncidentnterfaceB' strS96' .ield6ist2 * 55 #lose ncident #atch e- As %&#.ARS$stem.AR,-ception Throw 3ew S$stem.,-ception0e-.&essage' e-.nner,-ception2 ,-it Sub #atch ir As ,-ception Throw 3ew S$stem.,-ception0ir.&essage' ir.nner,-ception2 ,nd Tr$ ,nd Sub * 55 .unction to return 1alues from command line. .unction @etArgValue0%$Ref ArgArra$02 As String' %$Val SwitchValue As String' %$Ref ,rr&sg As String2 As String * Return switch 1alues from command line. * Switches and 1alues must onl$ come in pairs' ie. =u 4ser =p Password =s Ser1er Tr$ .or i As nteger A 0 To 4%ound0ArgArra$2 Step 2 f ArgArra$0i2 A SwitchValue Then Return ArgArra$0i K "2 ,nd f 3e-t #atch e- As ,-ception ,rr&sg A e-.&essage ,nd Tr$ Return String.,mpt$ ,nd .unction * 55 #lass To 6og nto ARSer1er Public #lass ARSnitialise * 55 Parameters ?btained .rom #md 6ine nput Public Shared .unction 6ogin02 As ARS$stem.Ser1er Tr$ /im Remed$Ser1er As 3ew ARS$stem.Ser1er *Remed$Ser1er.6ogin0ser1er)A' user)A' password)A' port)A2 Remed$Ser1er.6ogin0ARSer1er3ame' AR4ser' ARPassword2 *Remed$Ser1er.SetSer1erPort0port)A' rpcProgram3um)A2 Remed$Ser1er.SetSer1erPort0ARSer1erPort' 02 /im 4sernfo02 As ARS$stem.4sernfo A Remed$Ser1er.@et6ist4ser0ARS$stem.Ser1er.4ser6istT$pe.&$self' 3ew /ate02000' "' "22 Return Remed$Ser1er #atch e- As ,-ception Throw 3ew S$stem.,-ception0e-.&essage' e-.nner,-ception2 ,-it .unction ,nd Tr$ ,nd .unction ,nd #lass ,nd &odule