PATCH: Set/Retrieve custom field value by CLI

Hi there,

The attachment is the patch for setting/retrieving custom field value by
CLI.

Any expert of RT, could you review my patch? This patch is against RT-3.5.5.

I will be very happy if the patch is accepted by the released RT-3.5.6.

Thanks.

  • Wang

custom-field.patch (2.09 KB)

Any expert of RT, could you review my patch? This patch is against RT-3.5.5.

I will be very happy if the patch is accepted by the released RT-3.5.6.

3.5.6 is already out, but I understand the sentiment :slight_smile:

  •        else {
    
  •            ($n, $s) = $ticket->_AddCustomFieldValue(
    
  •                         Field => $cf, Value => $val );
    
  •            $s =~ s/^# // if defined $s;
    
  •        }
    

That leading _ scares me. Any reason you’re using the private
_AddCustomFieldValue, rather than the public AddCustomFieldValue?

Sorry, I don’t reply to all previously.

Jesse Vincent wrote:

Any expert of RT, could you review my patch? This patch is against RT-3.5.5.

I will be very happy if the patch is accepted by the released RT-3.5.6.

3.5.6 is already out, but I understand the sentiment :slight_smile:

  •        else {
    
  •            ($n, $s) = $ticket->_AddCustomFieldValue(
    
  •                         Field => $cf, Value => $val );
    
  •            $s =~ s/^# // if defined $s;
    
  •        }
    

That leading _ scares me. Any reason you’re using the private
_AddCustomFieldValue, rather than the public AddCustomFieldValue?

Yes, I don’t like to call the private method. But I found that
AddCustomFieldValue doesn’t return any code and message. As you have
seen, I need the return code and message.

Am I wrong?

Thanks.

  • Wang

Sorry, I don’t reply to all previously.

Jesse Vincent wrote:

Any expert of RT, could you review my patch? This patch is against RT-3.5.5.

I will be very happy if the patch is accepted by the released RT-3.5.6.

3.5.6 is already out, but I understand the sentiment :slight_smile:

  •        else {
    
  •            ($n, $s) = $ticket->_AddCustomFieldValue(
    
  •                         Field => $cf, Value => $val );
    
  •            $s =~ s/^# // if defined $s;
    
  •        }
    

That leading _ scares me. Any reason you’re using the private
_AddCustomFieldValue, rather than the public AddCustomFieldValue?

Yes, I don’t like to call the private method. But I found that
AddCustomFieldValue doesn’t return any code and message. As you have
seen, I need the return code and message.

Am I wrong?
Yes. It returns, perl returns from function last calculated value.

Thanks.

  • Wang

Rt-devel mailing list
Rt-devel@lists.bestpractical.com
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-devel

Best regards, Ruslan.

Ruslan Zakirov wrote:

Yes. It returns, perl returns from function last calculated value.

Sorry, it’s my fault. Here is my new patch.

custom-field.patch (2.19 KB)

lwang wrote:

Sorry, it’s my fault. Here is my new patch.

Hello,

Has anyone used this patch? If so, could someone provide me with the
syntax on how it should be used in scripts that I write?

TIA,

Stewart
Stewart Tranter
Computing Services
Loughborough University

E: s.g.tranter@lboro.ac.uk
W: http://www.lboro.ac.uk/computing/
T: +44 (0) 1509 223719
F: +44 (0) 1509 223989

The syntax to use this patch:

If you type “rt show ticket/100”, it will display the following in my case:

id: ticket/100

TimeLeft: 0
CF-Alias:
CF-Version: HEAD
CF-Status_Whiteboard:
CF-Severity: S3 (normal)

You can see I have 4 custom fields for every ticket. “CF-” is followed
immediately by the name of the custom field.

Similarly, if you want to create a new ticket, custom field will be
specified in the same way:

rt create -t ticket set subject=“test” add CF-Severity=“S3 (normal)”

You can check the created ticket by “rt show ticket/xxx”.

Please keep in mind that the name of the custom field cannot contain
empty space.

Good luck!

  • Wang

[Patch applied for RT 3.5.8. Thanks!]On Tue, Jan 10, 2006 at 10:53:03AM +0800, lwang wrote:

The syntax to use this patch:

If you type “rt show ticket/100”, it will display the following in my case:

id: ticket/100

TimeLeft: 0
CF-Alias:
CF-Version: HEAD
CF-Status_Whiteboard:
CF-Severity: S3 (normal)

You can see I have 4 custom fields for every ticket. “CF-” is followed
immediately by the name of the custom field.

Similarly, if you want to create a new ticket, custom field will be
specified in the same way:

rt create -t ticket set subject=“test” add CF-Severity=“S3 (normal)”

You can check the created ticket by “rt show ticket/xxx”.

Please keep in mind that the name of the custom field cannot contain
empty space.

Good luck!

  • Wang

Rt-devel mailing list
Rt-devel@lists.bestpractical.com
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-devel

Jesse,
I am very happy to do this. :slight_smile:

Jesse Vincent wrote:

Jesse,
I am very happy to do this. :slight_smile:

Sorry it took so long :slight_smile: The bugzilla importer sounds very cool. I’m
looking forward to finding time to poke at it.

Thanks!
Jesse