How to add custom field

Hi Friends,

I am very new to this list and looking for help.

How can we add the value of custom field on submission of mail. I am
using rt3. Basically we are using some interface where we submit the
mail to rt-system and want to use the value of custom fields in our
rtsystem through this interface.

Kuldeep Singh Tomar
Open Source Specialist
VCLABS

Kuldeep Singh Tomar writes:

How can we add the value of custom field on submission of mail. I am
using rt3. Basically we are using some interface where we submit the
mail to rt-system and want to use the value of custom fields in our
rtsystem through this interface.

Assuming you mean assign custom field values to tickets and not create new
custom field values…

Here’s a patch for 3.0.9 that adds the ability to parse X- headers in
email. It currently only uses MailFrom authentication. It will process
several field types, most notably Select custom fields. Read the patch for
details on use, but here are a couple of examples:

X-owner: stock
X-status: resolved
X-customfoobar: flammable

Jesse, are you interested in taking this as part of 3.0.x or as a contrib?
-Matt

Matthew D. Stock stock@cse.buffalo.edu
Director of Information Technology
Computer Science and Engineering, University at Buffalo

command-email.patch (6.37 KB)

Hi Matthew,

Yes, you are right. I need to display the value of custom field in web
interface given by mail or better to say parse it.
Thanks a lot for your answer and patch, I am looking into it and get
back to you soon.

Thanks again.

Kuldeep

Matthew D. Stock wrote:

Matthew,
I think this may solve another issue I posted (about resolving tickets via email). I applied the patch, but not sure if it’s working. Where exactly do I specify something like “X-status: resolved”? Is that in the body of the email or in the Subject or somewhere else?

PaulFrom: rt-devel-bounces@lists.bestpractical.com
[mailto:rt-devel-bounces@lists.bestpractical.com]On Behalf Of Matthew D.
Stock
Sent: Tuesday, March 30, 2004 5:38 AM
To: Kuldeep Singh Tomar
Cc: rt-devel@lists.bestpractical.com
Subject: Re: [rt-devel] How to add custom field

Kuldeep Singh Tomar writes:

How can we add the value of custom field on submission of mail. I am
using rt3. Basically we are using some interface where we submit the
mail to rt-system and want to use the value of custom fields in our
rtsystem through this interface.

Assuming you mean assign custom field values to tickets and not create new
custom field values…

Here’s a patch for 3.0.9 that adds the ability to parse X- headers in
email. It currently only uses MailFrom authentication. It will process
several field types, most notably Select custom fields. Read the patch for
details on use, but here are a couple of examples:

X-owner: stock
X-status: resolved
X-customfoobar: flammable

Jesse, are you interested in taking this as part of 3.0.x or as a contrib?
-Matt

Matthew D. Stock stock@cse.buffalo.edu
Director of Information Technology
Computer Science and Engineering, University at Buffalo

Paul Barmaksezian writes:

I think this may solve another issue I posted (about resolving tickets
via email). I applied the patch, but not sure if it’s working. Where
exactly do I specify something like “X-status: resolved”? Is that in
the body of the email or in the Subject or somewhere else?

They’re headers, and so you need them to be in the header block along with
other headers like Subject and Date and so forth. Adding headers may be
difficult to do in some mail readers. It’s possible to do the parsing from
the body, but it would make the code a lot more complex. Given my
target audience, I didn’t think it was worth the bother.
-Matt

  • Matthew D. Stock [2004/03/30 12:25]:

Paul Barmaksezian writes:

I think this may solve another issue I posted (about resolving tickets
via email). I applied the patch, but not sure if it’s working. Where
exactly do I specify something like “X-status: resolved”? Is that in
the body of the email or in the Subject or somewhere else?

They’re headers, and so you need them to be in the header block along with
other headers like Subject and Date and so forth. Adding headers may be
difficult to do in some mail readers. It’s possible to do the parsing from
the body, but it would make the code a lot more complex. Given my
target audience, I didn’t think it was worth the bother.

I’ve always felt that the most appropriate way to handle setting attributes
via the mailgate was to create separate MIME parts for the body and
headers, and give the header part a content-type of
application/x-rt-headers (or something similar). This is the same basic
approach as looking for X-status style headers, but more reliable,
simpler to implement, and harder to get wrong, since there are no
heuristics involved. The user simply creates a separate file with the
attribute modifications, and attaches it.

(darren)

If history teaches us anything, it’s that everyone will be part of the
problem, but not everyone will be part of the solution.
– Larry Wall

darren chamberlain writes:

I’ve always felt that the most appropriate way to handle setting attributes
via the mailgate was to create separate MIME parts for the body and
headers, and give the header part a content-type of
application/x-rt-headers (or something similar). This is the same basic
approach as looking for X-status style headers, but more reliable,
simpler to implement, and harder to get wrong, since there are no
heuristics involved. The user simply creates a separate file with the
attribute modifications, and attaches it.

I was thinking about this too, but in my environment, it’s more of a pain
to form the attachment than it is to edit the headers. :slight_smile: Since the
point is being able to edit the status of tickets quickly, set attributes,
and so on, having to form a new attachment for each ticket is too slow.
Might as well just open up the web interface. For a programmatic change
(like what the original requestor was looking for) it would be ok though.
-Matt

Or just use the ‘ExtractCustomFieldValues’ scrip:
download.bestpractical.com/pub/rt/contrib/ gone
(But no auth, and only changes ‘custom’ fields, i.e. not ‘status’ etc.)
Cerion

Hi,

Sorry was away from office, so could not reply on list. I found this
method to be easier than others but it did not work. I have installed
this scrip and in my template put the text:

Location | “Body” | Delhi |

where Location is my custom field with having 2 options “Delhi or Pune”
and I want to extract text from Body with value “Delhi” or “Pune”

according to example in example template:

cf-name | Headername or “Body” | MatchString(re) | Postcmd

But it does not seem to be working. Any suggestion would be welcome.

Thanks in advance.

Kuldeep

Matthew D. Stock wrote:

Paul Barmaksezian writes:

I think this may solve another issue I posted (about resolving tickets
via email). I applied the patch, but not sure if it’s working. Where
exactly do I specify something like “X-status: resolved”? Is that in
the body of the email or in the Subject or somewhere else?

They’re headers, and so you need them to be in the header block along with
other headers like Subject and Date and so forth. Adding headers may be
difficult to do in some mail readers. It’s possible to do the parsing from
the body, but it would make the code a lot more complex. Given my
target audience, I didn’t think it was worth the bother.
-Matt

Kuldeep Singh Tomar
Open Source Specialist
VCLABS

Hi,

Sorry was away from office, so could not reply on list. I found this
method to be easier than others but it did not work. I have installed
this scrip and in my template put the text:

Location | “Body” | Delhi |

where Location is my custom field with having 2 options “Delhi or Pune”
and I want to extract text from Body with value “Delhi” or “Pune”

  1. Take the quotes off ‘Body’
  2. the third field is a regular expresion.
    So, if you do something like:
    Location|Body|Location:\s*(Delhi|Pune)|
    This’ll accept the values Delhi, Pune from the line in the email body, e.g.
    Location: Delhi

If you don’t want the 'Location: ’ bit, and just want to search on a line that
has only those values on it, you might want something like:
Location|Body|^(Delhi|Pune)$|

Hope that’s clear,
Cerion

P.S. There’s lots of perl refs on the web, e.g.:

Hi Cerion,

I tried it, but it is still not working. I am sending body part of mail to you:

In case you would like to add any comments or information regarding your problem/ticket please click on above URL. Click on the comments option and add your comments there.

Please enter the folowing login credentials:

Username: guest
Password: guest

Thanks,

PS : There is no need to reply to this message right now.

Summary of the ticket appears below.

User Name :kuldeep
Email ID :tomar@vcustomer.com
Workstation # :143.033
Contact Number :33044
Location :Delhi
Account :VCLABS
Problem :Problem with the software / Tool
Comments :TESTING PLEASE IGNORE
Severity :S5
Department :System
Number of users Affected :Single

I want to grep the value of Location and Severity and put into CustomField Location and severity. I have installed the scrip ExtractCustomFieldValues-1.0b1 on rt system. I have made a scrip LocationExtract which is taking template with text as suggested by you and working on OnCreate:

Location|Body|Location\s*:\s*(Delhi|Pune)| (It has spaces after location)

But it is not taking value of Location from body part to Custom Field. I tried different regex and it is not working. Thanks for your guidence. What else could be the problem…

With Regards,

Kuldeep Singh

Cerion Armour-Brown wrote:>On Thursday 01 April 2004 17:09, Kuldeep Singh Tomar wrote:

Hi,

Sorry was away from office, so could not reply on list. I found this
method to be easier than others but it did not work. I have installed
this scrip and in my template put the text:

Location | “Body” | Delhi |

where Location is my custom field with having 2 options “Delhi or Pune”
and I want to extract text from Body with value “Delhi” or “Pune”

  1. Take the quotes off ‘Body’
  2. the third field is a regular expresion.
    So, if you do something like:
    Location|Body|Location:\s*(Delhi|Pune)|
    This’ll accept the values Delhi, Pune from the line in the email body, e.g.
    Location: Delhi

If you don’t want the 'Location: ’ bit, and just want to search on a line that
has only those values on it, you might want something like:
Location|Body|^(Delhi|Pune)$|

Hope that’s clear,
Cerion

P.S. There’s lots of perl refs on the web, e.g.:
http://search.cpan.org/~nwclark/perl-5.8.2/pod/perlreref.pod


rt-devel mailing list
rt-devel@lists.bestpractical.com
The rt-devel Archives

Kuldeep Singh Tomar
Open Source Specialist
VCLABS

Hi,

Waiting for input from team. I have tried different options but nothing
seems to be working. But I tried one option:

Location | “Body” | ^Delhi |

and it able to capture the value as Delhi if input is Delhi. But it is
not working when I am putting or option

^(Delhi | Pune)

same thing is not working for severity where I tried

^S\d (looking for values like S1, S2, S3, S4 etc…)

Some one from the team, who has exp. in it, please share his knowledge.
Really stuck to it now.

Thanks in advance.

Kuldeep Singh

kuldeep wrote:

Hi Cerion,

I tried it, but it is still not working. I am sending body part of
mail to you:


In case you would like to add any comments or information regarding
your problem/ticket please click on above URL. Click on the comments
option and add your comments there.

Please enter the folowing login credentials:

Username: guest
Password: guest

Thanks,

PS : There is no need to reply to this message right now.

Summary of the ticket appears below.

User Name :kuldeep
Email ID :tomar@vcustomer.com
Workstation # :143.033
Contact Number :33044
Location :Delhi
Account :VCLABS
Problem :Problem with the software / Tool
Comments :TESTING PLEASE IGNORE
Severity :S5
Department :System
Number of users Affected :Single

I want to grep the value of Location and Severity and put into
CustomField Location and severity. I have installed the scrip
ExtractCustomFieldValues-1.0b1 on rt system. I have made a scrip
LocationExtract which is taking template with text as suggested by you
and working on OnCreate:

Location|Body|Location\s*:\s*(Delhi|Pune)| (It has spaces after
location)

But it is not taking value of Location from body part to Custom Field.
I tried different regex and it is not working. Thanks for your
guidence. What else could be the problem…

With Regards,

Kuldeep Singh

Cerion Armour-Brown wrote:

Hi,

Sorry was away from office, so could not reply on list. I found this
method to be easier than others but it did not work. I have installed
this scrip and in my template put the text:

Location | “Body” | Delhi |

where Location is my custom field with having 2 options “Delhi or Pune”
and I want to extract text from Body with value “Delhi” or “Pune”

  1. Take the quotes off ‘Body’
  2. the third field is a regular expresion.
    So, if you do something like:
    Location|Body|Location:\s*(Delhi|Pune)|
    This’ll accept the values Delhi, Pune from the line in the email
    body, e.g.
    Location: Delhi

If you don’t want the 'Location: ’ bit, and just want to search on a
line that has only those values on it, you might want something like:
Location|Body|^(Delhi|Pune)$|

Hope that’s clear,
Cerion

P.S. There’s lots of perl refs on the web, e.g.:
http://search.cpan.org/~nwclark/perl-5.8.2/pod/perlreref.pod


rt-devel mailing list
rt-devel@lists.bestpractical.com
The rt-devel Archives

Kuldeep Singh Tomar
Open Source Specialist
VCLABS

What does the log say?
/opt/rt3/var/log/rt.log
(Make sure $LogToFile is ‘debug’ in RT_SiteConfig.pm)
Cerion
P.S. This should really be in rt-users - you might get more help there.On Friday 02 April 2004 15:38, Kuldeep Singh Tomar wrote:

Hi,

Waiting for input from team. I have tried different options but nothing
seems to be working. But I tried one option:

Location | “Body” | ^Delhi |

and it able to capture the value as Delhi if input is Delhi. But it is
not working when I am putting or option

^(Delhi | Pune)

same thing is not working for severity where I tried

^S\d (looking for values like S1, S2, S3, S4 etc…)

Some one from the team, who has exp. in it, please share his knowledge.
Really stuck to it now.

Thanks in advance.

Kuldeep Singh

kuldeep wrote:

Hi Cerion,

I tried it, but it is still not working. I am sending body part of
mail to you:



In case you would like to add any comments or information regarding
your problem/ticket please click on above URL. Click on the comments
option and add your comments there.

Please enter the folowing login credentials:

Username: guest
Password: guest

Thanks,

PS : There is no need to reply to this message right now.

Summary of the ticket appears below.

User Name :kuldeep
Email ID :tomar@vcustomer.com
Workstation # :143.033
Contact Number :33044
Location :Delhi
Account :VCLABS
Problem :Problem with the software / Tool
Comments :TESTING PLEASE IGNORE
Severity :S5
Department :System
Number of users Affected :Single


I want to grep the value of Location and Severity and put into
CustomField Location and severity. I have installed the scrip
ExtractCustomFieldValues-1.0b1 on rt system. I have made a scrip
LocationExtract which is taking template with text as suggested by you
and working on OnCreate:

Location|Body|Location\s*:\s*(Delhi|Pune)| (It has spaces after
location)

But it is not taking value of Location from body part to Custom Field.
I tried different regex and it is not working. Thanks for your
guidence. What else could be the problem…

With Regards,

Kuldeep Singh

Cerion Armour-Brown wrote:

On Thursday 01 April 2004 17:09, Kuldeep Singh Tomar wrote:

Hi,

Sorry was away from office, so could not reply on list. I found this
method to be easier than others but it did not work. I have installed
this scrip and in my template put the text:

Location | “Body” | Delhi |

where Location is my custom field with having 2 options “Delhi or Pune”
and I want to extract text from Body with value “Delhi” or “Pune”

  1. Take the quotes off ‘Body’
  2. the third field is a regular expresion.
    So, if you do something like:
    Location|Body|Location:\s*(Delhi|Pune)|
    This’ll accept the values Delhi, Pune from the line in the email
    body, e.g.
    Location: Delhi

If you don’t want the 'Location: ’ bit, and just want to search on a
line that has only those values on it, you might want something like:
Location|Body|^(Delhi|Pune)$|

Hope that’s clear,
Cerion

P.S. There’s lots of perl refs on the web, e.g.:
http://search.cpan.org/~nwclark/perl-5.8.2/pod/perlreref.pod


rt-devel mailing list
rt-devel@lists.bestpractical.com
The rt-devel Archives

Hi Cerion,

I have done some changes and it is working now. Thanks for your help :slight_smile:

With Regards,

Kuldeep

Cerion Armour-Brown wrote:

What does the log say?
/opt/rt3/var/log/rt.log
(Make sure $LogToFile is ‘debug’ in RT_SiteConfig.pm)
Cerion
P.S. This should really be in rt-users - you might get more help there.

Hi,

Waiting for input from team. I have tried different options but nothing
seems to be working. But I tried one option:

Location | “Body” | ^Delhi |

and it able to capture the value as Delhi if input is Delhi. But it is
not working when I am putting or option

^(Delhi | Pune)

same thing is not working for severity where I tried

^S\d (looking for values like S1, S2, S3, S4 etc…)

Some one from the team, who has exp. in it, please share his knowledge.
Really stuck to it now.

Thanks in advance.

Kuldeep Singh

kuldeep wrote:

Hi Cerion,

I tried it, but it is still not working. I am sending body part of
mail to you:



In case you would like to add any comments or information regarding
your problem/ticket please click on above URL. Click on the comments
option and add your comments there.

Please enter the folowing login credentials:

Username: guest
Password: guest

Thanks,

PS : There is no need to reply to this message right now.

Summary of the ticket appears below.

User Name :kuldeep
Email ID :tomar@vcustomer.com
Workstation # :143.033
Contact Number :33044
Location :Delhi
Account :VCLABS
Problem :Problem with the software / Tool
Comments :TESTING PLEASE IGNORE
Severity :S5
Department :System
Number of users Affected :Single


I want to grep the value of Location and Severity and put into
CustomField Location and severity. I have installed the scrip
ExtractCustomFieldValues-1.0b1 on rt system. I have made a scrip
LocationExtract which is taking template with text as suggested by you
and working on OnCreate:

Location|Body|Location\s*:\s*(Delhi|Pune)| (It has spaces after
location)

But it is not taking value of Location from body part to Custom Field.
I tried different regex and it is not working. Thanks for your
guidence. What else could be the problem…

With Regards,

Kuldeep Singh

Cerion Armour-Brown wrote:

Hi,

Sorry was away from office, so could not reply on list. I found this
method to be easier than others but it did not work. I have installed
this scrip and in my template put the text:

Location | “Body” | Delhi |

where Location is my custom field with having 2 options “Delhi or Pune”
and I want to extract text from Body with value “Delhi” or “Pune”

  1. Take the quotes off ‘Body’
  2. the third field is a regular expresion.
    So, if you do something like:
    Location|Body|Location:\s*(Delhi|Pune)|
    This’ll accept the values Delhi, Pune from the line in the email
    body, e.g.
    Location: Delhi

If you don’t want the 'Location: ’ bit, and just want to search on a
line that has only those values on it, you might want something like:
Location|Body|^(Delhi|Pune)$|

Hope that’s clear,
Cerion

P.S. There’s lots of perl refs on the web, e.g.:
http://search.cpan.org/~nwclark/perl-5.8.2/pod/perlreref.pod


rt-devel mailing list
rt-devel@lists.bestpractical.com
The rt-devel Archives


rt-devel mailing list
rt-devel@lists.bestpractical.com
The rt-devel Archives

Kuldeep Singh Tomar
Open Source Specialist
VCLABS

It may help others in the future if you post your changes here!
CerionOn Friday 02 April 2004 18:09, Kuldeep Singh Tomar wrote:

Hi Cerion,

I have done some changes and it is working now. Thanks for your help :slight_smile:

With Regards,

Kuldeep

Cerion Armour-Brown wrote:

What does the log say?
/opt/rt3/var/log/rt.log
(Make sure $LogToFile is ‘debug’ in RT_SiteConfig.pm)
Cerion
P.S. This should really be in rt-users - you might get more help there.

On Friday 02 April 2004 15:38, Kuldeep Singh Tomar wrote:

Hi,

Waiting for input from team. I have tried different options but nothing
seems to be working. But I tried one option:

Location | “Body” | ^Delhi |

and it able to capture the value as Delhi if input is Delhi. But it is
not working when I am putting or option

^(Delhi | Pune)

same thing is not working for severity where I tried

^S\d (looking for values like S1, S2, S3, S4 etc…)

Some one from the team, who has exp. in it, please share his knowledge.
Really stuck to it now.

Thanks in advance.

Kuldeep Singh

kuldeep wrote:

Hi Cerion,

I tried it, but it is still not working. I am sending body part of
mail to you:



In case you would like to add any comments or information regarding
your problem/ticket please click on above URL. Click on the comments
option and add your comments there.

Please enter the folowing login credentials:

Username: guest
Password: guest

Thanks,

PS : There is no need to reply to this message right now.

Summary of the ticket appears below.

User Name :kuldeep
Email ID :tomar@vcustomer.com
Workstation # :143.033
Contact Number :33044
Location :Delhi
Account :VCLABS
Problem :Problem with the software / Tool
Comments :TESTING PLEASE IGNORE
Severity :S5
Department :System
Number of users Affected :Single


I want to grep the value of Location and Severity and put into
CustomField Location and severity. I have installed the scrip
ExtractCustomFieldValues-1.0b1 on rt system. I have made a scrip
LocationExtract which is taking template with text as suggested by you
and working on OnCreate:

Location|Body|Location\s*:\s*(Delhi|Pune)| (It has spaces after
location)

But it is not taking value of Location from body part to Custom Field.
I tried different regex and it is not working. Thanks for your
guidence. What else could be the problem…

With Regards,

Kuldeep Singh

Cerion Armour-Brown wrote:

On Thursday 01 April 2004 17:09, Kuldeep Singh Tomar wrote:

Hi,

Sorry was away from office, so could not reply on list. I found this
method to be easier than others but it did not work. I have installed
this scrip and in my template put the text:

Location | “Body” | Delhi |

where Location is my custom field with having 2 options “Delhi or
Pune” and I want to extract text from Body with value “Delhi” or
“Pune”

  1. Take the quotes off ‘Body’
  2. the third field is a regular expresion.
    So, if you do something like:
    Location|Body|Location:\s*(Delhi|Pune)|
    This’ll accept the values Delhi, Pune from the line in the email
    body, e.g.
    Location: Delhi

If you don’t want the 'Location: ’ bit, and just want to search on a
line that has only those values on it, you might want something like:
Location|Body|^(Delhi|Pune)$|

Hope that’s clear,
Cerion

P.S. There’s lots of perl refs on the web, e.g.:
http://search.cpan.org/~nwclark/perl-5.8.2/pod/perlreref.pod


rt-devel mailing list
rt-devel@lists.bestpractical.com
The rt-devel Archives


rt-devel mailing list
rt-devel@lists.bestpractical.com
The rt-devel Archives