You need in Custom action prep code: return 1; and at the end of my example also a: return 1;
> -----Ursprüngliche Nachricht----- > Von: Steven Platt [mailto:[email protected]] > Gesendet: Donnerstag, 20. Mai 2010 15:44 > An: Loos, Christian > Cc: [email protected] > Betreff: RE: Date format to set Due Date with scrip? > > Thanks Chris, > > Unfortunately this gives me a 'ticket could not be created due to an > internal error' message. Tried it both as a regular and as a > privileged > user. > > The notification emails are generated but a search for the > ticket number > gives 'Could not load ticket NUMBER'. The ticket number is also > incremented. > > > teve > > > -----Original Message----- > From: Christian Loos [mailto:[email protected]] > Sent: 20 May 2010 14:24 > To: Steven Platt > Cc: [email protected] > Subject: Re: Date format to set Due Date with scrip? > > I think better would be this way: > > my $Due = new RT::Date( $self->CurrentUser ); > $Due->SetToNow; > $Due->AddDays( 7 ); > $self->TicketObj->SetDue( Format =>, 'ISO', Value => $Due->ISO ); > > > -- > Chris > > Am 20.05.2010 14:28, schrieb Steven Platt: > > Hi, > > > > The config setting 'Requests should be due in:' is not > working, so I'm > > trying to write a scrip to set the DueDate on ticket > creation. I'm on > RT > > v3.6.2 and don't want to upgrade just for this issue. > > > > Following advice on the wiki I've got the following > > > > Condition: On Create > > > > Action: user defined > > > > Template: Global template: blank > > > > Custom action prep code: 1; > > > > Custom action cleanup code: > > > > use Date::Calc qw(:all); > > > > ($year,$month,$day) = Today([$gmt]); > > > > ($year2,$month2,$day2) = Add_Delta_Days($year,$month,$day,"7"); > > > > $string = Date_to_Text($year2,$month2,$day2); > > > > $lower = ISO_LC($string); > > > > $self->TicketObj->SetDue($lower); > > > > Due Date is not set though L > > > > Running this on command line, $lower prints a date formatted as 'thu > > 27-may-2010' > > > > I can hack around with the date format if someone can tell > me what it > > should be so that RT will accept it into the database (postgres). > > > > Thanks > > > > Steve > > > > Dr Steven Platt > > > > Bioinformatician > > > > Health Protection Agency > > > > Centre for Infections > > > > London > > > > ___www.hpa.org.uk/bioinformatics_ > <http://www.hpa.org.uk/bioinformatics> > > > > > -------------------------------------------------------------- > ---------- > > > > * > > > ************************************************************** > ********** > ** > > The information contained in the EMail and any attachments is > > confidential and intended solely and for the attention and > use of the > > named addressee(s). It may not be disclosed to any other person > without > > the express authority of the HPA, or the intended > recipient, or both. > If > > you are not the intended recipient, you must not disclose, copy, > > distribute or retain this message or any part of it. This footnote > also > > confirms that this EMail has been swept for computer viruses, but > please > > re-sweep any attachments before opening or saving. > HTTP://www.HPA.org.uk > > > ************************************************************** > ********** > ** * > > > > > > > > > > Discover RT's hidden secrets with RT Essentials from O'Reilly Media. > > Buy a copy at http://rtbook.bestpractical.com > > ----------------------------------------- > ************************************************************** > ************ > The information contained in the EMail and any attachments is > confidential and intended solely and for the attention and use of > the named addressee(s). It may not be disclosed to any other person > without the express authority of the HPA, or the intended > recipient, or both. If you are not the intended recipient, you must > not disclose, copy, distribute or retain this message or any part > of it. This footnote also confirms that this EMail has been swept > for computer viruses, but please re-sweep any attachments before > opening or saving. HTTP://www.HPA.org.uk > ************************************************************** > ************ > Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com
