RE: [Arsperl-users] REmedy problem
Brought to you by:
jeffmurphy
|
From: Amen A. <aas...@ho...> - 2005-06-09 15:53:03
|
Yes it does it prints out the word "Sent" and it also creates a txt file
which we also need.
Amen.
>From: Steve McDonald <ste...@ch...>
>Reply-To: ars...@ar...
>To: ars...@ar...
>Subject: RE: [Arsperl-users] REmedy problem
>Date: Thu, 09 Jun 2005 08:20:22 -0700
>
>Does this script work from the command line?
>
>-----Original Message-----
>From: ars...@ar...
>[mailto:ars...@ar...] On Behalf Of Amen Asemota
>Sent: Thursday, June 09, 2005 6:42 AM
>To: ars...@ar...
>Subject: Re: [Arsperl-users] REmedy problem
>
>Hi Carey and Steve,
>
>Here is my Code :
>
>#!/usr/bin/perl
>
>#use strict 'vars';
>my $status = "Active";
>my $count3 = 0;
>my $countDTR = 0;
>my @save_DTR;
>my @save_entry;
>my @save_type;
>my @save_PartNumber;
>my @save_ProductName;
>my @save_qty;
>my @save_unitCost;
>my @save_ExtendedCost;
>my $save_filename;
>my $DTR = "DTR";
>my $flag = 1;
>my $flag2 = "Sent" ;
>
>use arControl;
>my $server = $arControl::SERVER;
>my $username = $arControl::USERNAME;
>my $pw = $arControl::PW;
>use ARS;
>#open(TXT,">datafile.txt") ||die printf "unable to open flat file\n";
>
># text file opened
>#printf "The datafile has been opened\n";
>$ctrl = ars_Login($server,$username,$pw)||die printf "AR Server login
>Error\n";
>#$query = "'650001031' != \$NULL\$";
>#my $query = "'Assigned To' != \$NULL\$";
>my $query = "'PO Flag?'!= \$NULL\$";
>my $qual = ars_LoadQualifier($ctrl, "Schema",$query);
>if(!defined($qual))
>{
> $error = "Unable to create Schema Load qualifier
>$ars_errstr";
>}
>
># created the qualifier
>#printf "Qualifier has been created\n";
>%firstentry = ars_GetListEntry($ctrl,"Schema",$qual,0);
>#getting DTR numbers
>#printf "DTR numbers being retrieved\n";
>foreach $entryId (sort keys %firstentry)
>{
> %firstvalue = ars_GetEntry($ctrl,"Schema", $entryId,
>650001006);
> foreach $entryId (sort keys %firstvalue)
> {
> $save_DTR{$countDTR} = $firstvalue{650001006};
> $save_entry{$countDTR} = $entryId;
># printf $save_DTR{$countDTR};
> $countDTR++;
> }
>}
>#printf("DTR count=%d\n",$countDTR);
># creating the header file
>print TXT "H","0001","0000000","000000","000","0000000000";
>print TXT "00000","00000","00000000";
># Retrieving the Items for this DTR table
>
>$qualb = ars_LoadQualifier($ctrl,"Schema2", "1=1");
>if(!defined($qualb))
> {
> $error = "Unable to create Schema2 Load qual
>ifier $ars_errstr";
> }
>for($count3 = 0; $count3 < $countDTR; $count3++)
>{# printf("next DTR=%s\n",$save_DTR{$count3});
>$save_filename = $DTR.$save_DTR{$count3};
>open(TXT,">$save_filename.txt") ||die printf "unable to open flat file\n";
>#printf($save_filename, "\n");
>%second = ars_GetListEntry($ctrl,"Schema2",$qualb, 0);
>my $allHWSW=0;
>my $prtHWSW=0;
>
>foreach $entryId(sort keys %second)
>{ $allHWSW++;
> #Gets table information
> %secondvalue = ars_GetEntry($ctrl,"Schema2",$entryId,
>650008002,8,7,650008003,650008007,
> 650008016,650008005,650008004,650008015);
> if(($secondvalue{650008002} eq $save_DTR{$count3}) &&
>(($secondvalue{6500
>08015} == 0) && ($secondvalue{7} == 0)))
> { $prtHWSW++;
> $save_type{$count3}= $secondvalue{8};
> $save_PartNumber{$count3} = $secondvalue{650008003};
> $save_ProductName{$count3} = $secondvalue{650008007};
> $save_qty{$count3} = $secondvalue{650008016};
> $save_unitCost{$count3} = $secondvalue{650008005};
> $save_extendedCost{$count3} = $secondvalue{650008004};
> $save_WO{$count3} = $secondvalue{650008015};
> $save_Status{$count3} = $secondvalue{7};
> #send items to file
> print TXT $save_DTR{$count3};
> print TXT "L","0001","0000000","000000","000","0";
> print TXT $save_type{$count3};
> print TXT $save_PartNumber{$count3};
> print TXT $save_ProductName{$count3}," ";
> print TXT $save_qty{$count3}," ";
> print TXT $save_unitCost{$count3}," ";
> print TXT $save_extendedCost{$count3};
> #$count3++;
> }
> }
>#printf(" allHWSW=%d prtHWSW=%d\n",$allHWSW,$prtHWSW);
>close(TXT);
>}
>
>#close(TXT);
>ars_Logoff($ctrl);
>print "Sent \n";
>exit(0);
>
>
>
>
>Then in the Remedy filter i enter the process $PROCESS$ /path/file.pl
>because I want it to Set a text field in the filter to "Sent". With the
>exit(0), I am still getting the same error msg. This script compiles with
>no
>
>problem in Unix and it prints out Sent to the STDOUT but when I use it in
>the set field it keep getting the error ARERR [38] Filter/escalation 'set
>field' process returned an error.
>
>
>
>Thanks.
>
>Amen.
>
> >From: Carey Matthew Black <bla...@gm...>
> >Reply-To: ars...@ar...
> >To: ars...@ar...
> >Subject: Re: [Arsperl-users] REmedy problem
> >Date: Wed, 8 Jun 2005 11:04:16 -0500
> >
> >Amen,
> >
> >Make sure your script always exits with status zero.
> >exit(0);
> >If you do not exit with a status of zero then the ARS server will
> >throw an exception.
> >
> >print anything to STDOUT that you want to to end up in the field.
> >
> >A simple example would be:
> >#! /usr/bin/perl
> >print "The fields new value is this whole string";
> >exit(0);
> >
> >
> >Also .. in the filter.. make sure you fully qualify the path to the
> >perl script and maybe even perl itself.
> >
> >/path/to/myscript/junk.pl
> >
> >or maybe...
> >
> >/usr/bin/perl /path/to/myscript/junk.pl
> >
> >
> >You can also run Filter logs and check the arerror.log for more
> >details on what the ARS server is seeing from the script too.
> >
> >Hope that helps.
> >
> >--
> >Carey Matthew Black
> >Remedy Skilled Professional (RSP)
> >ARS = Action Request System(Remedy)
> >
> >Solution = People + Process + Tools
> >Fast, Accurate, Cheap.... Pick two.
> >Never ascribe to malice, that which can be explained by incompetence.
> >
> >http://www.fellowshipchurch.com
> >
> >On 6/8/05, Amen Asemota <aas...@ho...> wrote:
> > > Hi,
> > >
> > > I am trying to run a perl script in a filter but i keep getting ARERR
> >[38]
> > > Filter/escalation 'set field' process returned an error.
> > >
> > > Iam trying to use the $PROCESS$ command to set a field . Please help..
> > >
> > > _________________________________________________________________
> > > Express yourself instantly with MSN Messenger! Download today it's
>FREE!
> > > http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
> > >
> > >
> > >
> > > -------------------------------------------------------
> > > This SF.Net email is sponsored by: NEC IT Guy Games. How far can you
> >shotput
> > > a projector? How fast can you ride your desk chair down the office
>luge
> >track?
> > > If you want to score the big prize, get to know the little guy.
> > > Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20
> > > _______________________________________________
> > > Arsperl-users mailing list
> > > Ars...@ar...
> > > https://lists.sourceforge.net/lists/listinfo/arsperl-users
> > >
> >
> >
> >
> >-------------------------------------------------------
> >This SF.Net email is sponsored by: NEC IT Guy Games. How far can you
> >shotput
> >a projector? How fast can you ride your desk chair down the office luge
> >track?
> >If you want to score the big prize, get to know the little guy.
> >Play to win an NEC 61" plasma display: http://www.necitguy.com/?r
> >_______________________________________________
> >Arsperl-users mailing list
> >Ars...@ar...
> >https://lists.sourceforge.net/lists/listinfo/arsperl-users
>
>_________________________________________________________________
>Express yourself instantly with MSN Messenger! Download today it's FREE!
>http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
>
>
>
>-------------------------------------------------------
>This SF.Net email is sponsored by: NEC IT Guy Games. How far can you
>shotput
>a projector? How fast can you ride your desk chair down the office luge
>track?
>If you want to score the big prize, get to know the little guy.
>Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20
>_______________________________________________
>Arsperl-users mailing list
>Ars...@ar...
>https://lists.sourceforge.net/lists/listinfo/arsperl-users
>
>
>
>-------------------------------------------------------
>This SF.Net email is sponsored by: NEC IT Guy Games. How far can you
>shotput
>a projector? How fast can you ride your desk chair down the office luge
>track?
>If you want to score the big prize, get to know the little guy.
>Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20
>_______________________________________________
>Arsperl-users mailing list
>Ars...@ar...
>https://lists.sourceforge.net/lists/listinfo/arsperl-users
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
|