hi, shouldn't you remove the trailing ; at the end of the line on the if statement ? if ($my_type =~ /^I/) { $self->TicketObj->AddCustomFieldValue(Field => 'SLA', Value => 'Urgent'); }; should be if ($my_type =~ /^I/) { $self->TicketObj->AddCustomFieldValue(Field => 'SLA', Value => 'Urgent'); }
Raphaël MOUNEYRES Bart <b...@pleh.info> Envoyé par : rt-users-boun...@lists.bestpractical.com 26/07/2011 14:41 A rt-users@lists.bestpractical.com cc Objet Re: [rt-users] Problem with making a custom scrip Hi Robert, Thanks for the reply, I've changed that setting but it doesn't seem to fully solve my problem (I do notice a difference). I've modified the scrip a little, it now looks like this: my $my_type = $self->TicketObj->FirstCustomFieldValue('Type'); if ($my_type =~ /^I/) { $self->TicketObj->AddCustomFieldValue(Field => 'SLA', Value => 'Urgent'); }; if ($my_type =~ /^C/) { $self->TicketObj->AddCustomFieldValue(Field => 'SLA', Value => 'Normal'); }; if ($my_type =~ /^P/) { $self->TicketObj->AddCustomFieldValue(Field => 'SLA', Value => 'Low'); }; The first problem I have is that the SLA is already set to the value "Normal", I see the scrip running but it keeps saying "Set SLA Low to Normal" or similar for Urgent (normal is ignored). So I get a feeling it does something, but it doesn't actually change the content of the SLA field. Maybe it's the type of CF that the SLA field is, it's a dropbox with the three options Urgent, Normal and Low. But I thought it shouldn't matter?! The second problem is that if the SLA field is set to (no value) then the scrip gives the error "Low is no longer a value for custom field SLA", which could be the same issue as the first? Not able to fill the actual field? Any thoughts on this? (the above code is a little different but I get the same results as the first code) Best regards, Bart 2011/7/26 Robert Wysocki <robert.wyso...@contium.pl> Dnia 2011-07-26, wto o godzinie 10:22 +0200, Bart pisze: (...) > my $my_type = $self->TicketObj->CustomFieldValues('Type'); Use $self->TicketObj->FirstCustomFieldValue('Type') instead. Regards, -- Robert Wysocki CONTIUM S.A., http://www.contium.pl -------- 2011 Training: http://bestpractical.com/services/training.html -------- 2011 Training: http://bestpractical.com/services/training.html # " Ce courriel et les documents qui lui sont joints peuvent contenir des informations confidentielles ou ayant un caractère privé. S'ils ne vous sont pas destinés, nous vous signalons qu'il est strictement interdit de les divulguer, de les reproduire ou d'en utiliser de quelque manière que ce soit le contenu. Si ce message vous a été transmis par erreur, merci d'en informer l'expéditeur et de supprimer immédiatement de votre système informatique ce courriel ainsi que tous les documents qui y sont attachés." ****** " This e-mail and any attached documents may contain confidential or proprietary information. If you are not the intended recipient, you are notified that any dissemination, copying of this e-mail and any attachments thereto or use of their contents by any means whatsoever is strictly prohibited. If you have received this e-mail in error, please advise the sender immediately and delete this e-mail and all attached documents from your computer system." #
-------- 2011 Training: http://bestpractical.com/services/training.html