Your script should probably look something like this:
my $ctrl = ars_Login( $server, $user, $passwd ); die "Login Error: $ars_errstr\n" if ! $ctrl; my %fieldValues = ( 100000038 => "stormgt", # PersonID 100000003 => "stormgt", # FirstName 100000001 => "stormgt", # Last Name 100000007 => $arrFields[2], # Comments Work Log 536870916 => $arrFields[3], # Group Assigned # ... remaining fields ..... ); my $entryId = ars_CreateEntry( $ctrl, $formName, %fieldValues ); die "Create Error: $ars_errstr\n" if ! $ctrl; Regards, Thilo Gary sperano wrote: > Hello All, > > I am extremely new to posting to this group as well as to the ASR > module for perl. I have been tasked with converting a a vbs script, that > currently creates remedy tickets, to perl. With that being said, I do > have a question in regards to the field ID, I think. > > The vbs script contains the following lines. I think, please > correct me if I am wrong, in between the parentheses is the field id. > Using the ARS module, how do I create the ticket using the field id? > Also, I need to make sure that a ticket number is returned to me and > that the process was successful, how do I do this? > > > > * fieldValues.Item(100000038)= "stormgt" 'PersonID* > > * fieldValues.Item(100000003) = "stormgt" 'FirstName* > > * fieldValues.Item(100000001) = "stormgt" 'Last Name* > > * fieldValues.Item(100000007) = arrFields(2) 'Comments Work Log* > > * fieldValues.Item(536870916) = arrFields(3) 'Group Assigned* > > * fieldValues.Item(100000031) = "Originating Call" 'Incident Relationship* > > * fieldValues.Item(100000017) = arrFields(4) 'Incident Type* > > * fieldValues.Item(100000039) = arrFields(5) 'Item Affected* > > * fieldValues.Item(536870932) = "SHCWeb_wsf" 'Originating Desk* > > * fieldValues.Item(100000013) = arrFields(6) 'Priority* > > * fieldValues.Item(8) = arrFields(7) 'Problem Summary* > > * fieldValues.Item(100000014) = arrFields(8) 'Problem Type* > > * fieldValues.Item(100000000) = arrFields(10) 'Symptoms* > > * fieldValues.Item(536870913) = arrFields(11) 'Problem Detail* > > * fieldValues.Item(536870912) = arrFields(12) 'Specific Issue* > > > > Below are the contents of the entire script that needs to be converted > > > > Thanks for any and all assistance you can offer > > > > <code> > > 'This script will parse TSO Backuplogs, and create GIRS tickets where needed > > > > Dim objFSO, objSource, objOutput, strLine > > Dim arrFields, headerline > > Dim OutputFile,ProxyName,Secword,Newword, FolderPath > > Dim objFolder, colFiles, objFile , ErrorLog, objErrorOutput > > > > ProxyName="prxpnbu" > > Secword="4Password" > > Const formName = "Incident" > > Dim server, fieldValues, entryId, result > > Set server = CreateObject("BMC.ARSystem.Server") > > Set fieldValues = CreateObject("BMC.ARSystem.FieldValueList") > > Newword=Chr(Asc(Left(Secword,1)+2)) & Mid(Secword,2) > > server.Login "server.my.company.com", ProxyName, Newword > > FolderPath="F:\Ticketing" > > Set objFSO = CreateObject("Scripting.FileSystemObject") > > Set objFolder= objFSO.GetFolder(FolderPath) > > Set colFiles= objFolder.Files > > For Each objFile In colFiles > > 'If the source file has the correct name, then process it, otherwise > move to next file. > > If instr(1,objFile.Name,"DPA_Ticket_Creator") Then > > 'If the file has content, process it > > If objFile.Size > 100 then > > 'Wscript.Echo objFile.name > > SourceFile = FolderPath & "\" & objFile.Name > > Set objSource= objFSO.OpenTextFile(SourceFile,1) > > 'If the log file doesn't exist, then create it. > > OutputFile="F:\Ticketing\Logs\Processed" & objFile.Name > > If objFSO.FileExists(OutputFile) Then > > Set objOutput= objFSO.OpenTextFile(OutputFile,1 ) > > 'If there is no header in the logfile, add it. > > If objoutput.AtEndOfStream = True Then > > objOutput.Close > > Set objOutput= objFSO.OpenTextFile(OutputFile,8) > > 'Copy original header > > strLine= objSource.ReadLine > > objOutput.WriteLine ("IncidentID," & strLine & ", > Ticket_Create_Time") > > Else > > 'Logfile already exists with content > > Set objOutput= objFSO.OpenTextFile(OutputFile,8) > > 'Skip headerline of source > > objSource.SkipLine > > End If > > Else > > Set objOutput=objFSO.CreateTextFile(OutputFile) > > objOutput.Close > > Set objOutput= objFSO.OpenTextFile(OutputFile,8 ) > > 'Copy original header > > strLine= objSource.ReadLine > > objOutput.WriteLine ("IncidentID," & strLine & "," & "Ticket > Create Time") > > End If > > Do Until objSource.AtEndOfStream > > On Error Resume Next > > strLine= objSource.ReadLine > > arrFields= Split(strLine, ",") > > 'Test Group Assigned To field to confirm that there is not a > ticket value there. > > 'If so, change to TSO-C/S Backup > > If UCASE(Mid(arrFields(3),1,1)) = "C" And > isnumeric(mid(arrFields(3),3,2))= True Then arrFields(3)= "TSO-C/S Backup" > > 'Enter values > > fieldValues.Item(100000038)= "stormgt" 'PersonID > > fieldValues.Item(100000003) = "stormgt" 'FirstName > > fieldValues.Item(100000001) = "stormgt" 'Last Name > > fieldValues.Item(100000007) = arrFields(2) 'Comments > Work Log > > fieldValues.Item(536870916) = arrFields(3) 'Group Assigned > > fieldValues.Item(100000031) = "Originating Call" 'Incident > Relationship > > fieldValues.Item(100000017) = arrFields(4) 'Incident Type > > fieldValues.Item(100000039) = arrFields(5) 'Item Affected > > fieldValues.Item(536870932) = "SHCWeb_wsf" 'Originating > Desk > > fieldValues.Item(100000013) = arrFields(6) 'Priority > > fieldValues.Item(8) = arrFields(7) 'Problem Summary > > fieldValues.Item(100000014) = arrFields(8) 'Problem Type > > fieldValues.Item(100000000) = arrFields(10) 'Symptoms > > fieldValues.Item(536870913) = arrFields(11) 'Problem Detail > > fieldValues.Item(536870912) = arrFields(12) 'Specific Issue > > Err.Clear > > 'Create ticket, and return ticket number > > entryId = server.CreateEntry(formName, fieldValues) > > If Err.Number<> 0 Then > > 'wscript.echo err.number > > 'If the line errored, create the ticket to Backup team > with default values > > fieldValues.Item(100000017) = arrFields(4) 'Incident > Type > > fieldValues.Item(100000039) = "ADSM Backup Client" > 'Item Affected > > fieldValues.Item(100000013) = "Medium" 'Priority > > fieldValues.Item(100000014) = "Software" 'Problem Type > > fieldValues.Item(536870913) = arrFields(11) 'Problem > Detail > > fieldValues.Item(536870912) = "nosla" 'Specific > Issue > > fieldValues.Item(536870916)= "TSO-C/S Backup" > > entryId = server.CreateEntry(formName, fieldValues) > > 'If it errors again, write line to error log > > ErrorLog="F:\Ticketing\Logs\Error" & objFile.Name > > If objFSO.FileExists(ErrorLog) Then > > Set objErrorOutput= objFSO.OpenTextFile(ErrorLog,8 ) > > objErrorOutput.WriteLine ("Error creating " & entryID > & "," & strLine) > > objErrorOutput.Close > > Else 'The Errorlog doesn't exist, create it > > Set objErrorOutput=objFSO.CreateTextFile(ErrorLog) > > objErrorOutput.Close > > Set objErrorOutput= objFSO.OpenTextFile(ErrorLog,8 ) > > objErrorOutput.WriteLine ("Error creating " & entryID > & "," & strLine) > > objErrorOutput.Close > > End If > > End If > > 'Write ticket information to log: IncidentID, Server, Timestamp > > strLine = entryId & "," & strline& "," & Date & " " & Time > > objOutput.WriteLine(strLine) > > Loop > > 'The source file is processed. Copy it to ...\logs\Original... > > objSource.Close > > objFSO.MoveFile FolderPath & "\" & objFile.Name, FolderPath & > "\Logs\Original" & objFile.Name > > Else 'The source file has no content, move/rename to > ...Logs\Empty & Name > > objFSO.MoveFile FolderPath & "\" & objFile.Name, FolderPath & > "\Logs\Empty" & objFile.Name > > End If > > End If 'Valid File end > > Next > > ' Cleanup > > Call server.Logout > > Set objErrorOutput=Nothing > > Set objSource= Nothing > > Set objOutput= Nothing > > Set entryId = Nothing > > Set result = Nothing > > Set fieldValues = Nothing > > Set server = Nothing > > > > </code> > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA > -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise > -Strategies to boost innovation and cut costs with open source participation > -Receive a $600 discount off the registration fee with the source code: SFAD > http://p.sf.net/sfu/XcvMzF8H > > > ------------------------------------------------------------------------ > > > > -- > Arsperl-users mailing list > Arsperl-users@arsperl.org > https://lists.sourceforge.net/lists/listinfo/arsperl-users ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H -- Arsperl-users mailing list Arsperl-users@arsperl.org https://lists.sourceforge.net/lists/listinfo/arsperl-users