Rt-4.0.5 - How to populate a custom field using a web service?

Hello,

I am looking at rt-4.0.5 and it seems that you can tie a custom field into
a web service. I am curious about using this method to populate an
autocomplete list for my custom field. Specifically I’d like to make an
autocomplete field which is populated with the name column of the AT_ASSETS
table using a SQL query like ‘SELECT name, description FROM AT_ASSETS ORDER
BY name ASC’ so that I can easily look up an asset and link it to my
ticket, so that I can use assets like a cmdb.

I am currently looking at /opt/rt4/docs/extending/external_custom_field.pod
and it seems like that solution may work, but it does not include any
detail about using a web service.

Is there any documentation about using a webservice or does someone have an
example of its use? Or if someone has details about doing something like I
described above using another method I’d love to hear about that too.

Thanks for your advice!
Jim

I am looking at rt-4.0.5 and it seems that you can tie a custom field into a
web service.

I created a PHP web form to try and drive requestors to put in the
proper information. What I provided was a drop down box to show
custom fields pulled from the RT database and then build a email to be
sent to the queue the user chose.

Is there any documentation about using a webservice or does someone have an
example of its use? Or if someone has details about doing something like I
described above using another method I’d love to hear about that too.

The following is the PHP code I used to pull the info (billing codes)
from the customfieldvalues table where the ID of the custom field I am
using is 1. Since this is a field that has a parent/child
relationship, this creates an option group heading with the selectable
fields in the drop down box under each option group. If you have just
one field and no relationships, it is much more simple. This requires
a database connection string which is in a file outside of my web
directory. I know this may not be exactly what you are looking for,
but the main part you are asking about I believe the part you are
looking for specifically is down at the end of building the message
where the custom fields are pushed into the email with commandbymail.
Note, I found out the custom fields could NOT have any spaces in them
for commandbymail to function. I hope this helps and is not too
confusing. I am quite sure some of this could be done more
efficiently. I am not a developer. I have a good understanding of
php, but not always the most efficient way.

—connection_file—

<?php $host = "database_server"; $user = "postgres"; $pass = "dbpassword"; $db = "rtdb"; $conn_rtdb = pg_connect("host=$host dbname=$db user=$user password=$pass") or die("Couldn't Connect to $db".pg_last_error()); ?>

—connection_file—
—ticket_form—

<?php //set page action based on how the user gets to the page (sendMail or showForm) $action = $_REQUEST['action']; global $action; ---form_code--- function showForm() { include('/path/to/connection_file'); $getclientproject = pg_query($conn_rtdb, "select name from customfieldvalues where customfield=1 order by name")or die("Get ClientProject " . pg_last_error()); $fields=pg_num_fields($getclientproject); echo "Task Code"; echo "Select..."; for ($i=0; $i < pg_num_fields($getclientproject); $i++) while ($row = pg_fetch_row($getclientproject)) { for ($f=0; $f < $fields; $f++) { echo "$row[$f]"; $gettaskcodes = pg_query($conn_rtdb, "select c.name from customfieldvalues a,attributes b,customfieldvalues c where a.name=b.content and b.objectid=c.id and b.content='$row[$f]' order by c.name,c.sortorder")or die("Get Codes ".pg_last_error()); $fields=pg_num_fields($gettaskcodes); for ($i=0; $i < pg_num_fields($gettaskcodes); $i++) while ($row = pg_fetch_row($gettaskcodes)) { for ($f=0; $f < $fields; $f++) { echo "$row[$f]"; echo ""; }} echo ""; }} echo ""; } //end action showForm ?>

—form_code—

Then I gather the form data to be pushed into RT as an email. I use
the commandbymail plugin to allow fields to be populated via email.
Then I build the email with PHP code to send to RT:

—form_submit—

<?php function sendMail() { include("/path/to/connection_file"); // Gather form data... each item that is pulled had its own field in the web form $to = $_REQUEST['sendto'] ; //whatever queue they chose in a dropdown box on the web form $from = "$_REQUEST['from_email']" ; $project = $_REQUEST['Project'] ; $priority = $_REQUEST['Priority'] ; $duedate = $_REQUEST['duedate'] ; $time = $_REQUEST['time'] ; $taskcode = $_REQUEST['taskcode'] ; $admincc = $_REQUEST['AdminCC'] ; //Get client project from RT database $getcp = pg_query($conn_rtdb, "select a.content from attributes a, customfieldvalues b where b.name='$taskcode' and b.id=a.objectid")or die("Get CP ".pg_last_error()); $rescp = pg_fetch_row($getcp); $cltprj = $rescp[0]; //create due date timestamp, concatenate fields and clean up strange characters $due = $duedate." ".$time ; $subjectdetails = pg_escape_string(stripslashes($_REQUEST['SubjectDetails'])) ; $body = pg_escape_string(stripslashes($_REQUEST['Body'])) ; $subject = $project.": " . $subjectdetails ; //Build data to be pushed into ticket for commandbymail $fields = array(); $fields{"Project"} = "Project"; $fields{"SubjectDetails"} = "Subject"; $fields{"Body"} = "Message"; foreach($fields as $a => $b) { $bodymessage .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); } //Build message headers $headers = "From: $from\n"; $headers .= "Reply-To: $from\n"; $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-Type: multipart/related; type=\"multipart/alternative\"; boundary=\"----=MIME_BOUNDRY_main_message\"\n"; $headers .= "X-Sender: $from\n"; $headers .= "X-Mailer: PHP4\n"; $headers .= "X-Priority: 3\n"; //1 = Urgent, 3 = Nmrmal $headers .= "Return-Path: <" . $_POST['Email'] . ">\n"; $headers .= "This is a multi-part message in MIME format.\n"; $headers .= "------=MIME_BOUNDRY_main_message \n"; $headers .= "Content-Type: multipart/alternative; boundary=\"----=MIME_BOUNDRY_message_parts\"\n"; //Build message contents $message = "------=MIME_BOUNDRY_message_parts\n"; $message .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n"; $message .= "Content-Transfer-Encoding: quoted-printable\n"; $message .= "\n"; /* Add custom message, in this case it's plain text. You could also add HTML by changing the Content-Type to text/html */ $message .= "Due: ".$duedate." ".$time."\n"; $message .= "Priority: ".$priority."\n"; if($admincc != 'none'){ $message .= "AdminCc: ".$admincc."\n"; } $message .= "CustomField.{Client_Project}: ".$cltprj."\n"; $message .= "CustomField.{Task_Code}: ".$taskcode."\n"; $message .= "CustomField.{Category}: ".$category."\n"; $message .= "\n"; $message .= "$bodymessage\n"; $message .= "\n"; $message .= "------=MIME_BOUNDRY_message_parts--\n"; $message .= "\n"; //Send message $ok = mail($to, $subject, $message, $headers); if($ok == 1) { echo "Your ticket has been sent."; } else { print "We encountered an error sending your mail, please notify the RT administrator"; } } ?. //Determine what state the form is in when the user gets to it <?php switch ($action) { case "send": sendMail(); showForm(); break; default: showForm(); } ?>

Hi Joe, that’s good information but I am looking to be able to use the web service to populate the autocomplete values for one specific RT CustomField within RT. When you are setting up a custom field the screen even says that you can use a web service to populate the field’s values, but I am not sure how to do that and I cannot find documentation.

Thanks,
Jim LesinskiOn Feb 6, 2012, at 7:19 AM, Joe Harris drey111@gmail.com wrote:

I am looking at rt-4.0.5 and it seems that you can tie a custom field into a
web service.

I created a PHP web form to try and drive requestors to put in the
proper information. What I provided was a drop down box to show
custom fields pulled from the RT database and then build a email to be
sent to the queue the user chose.

Is there any documentation about using a webservice or does someone have an
example of its use? Or if someone has details about doing something like I
described above using another method I’d love to hear about that too.

The following is the PHP code I used to pull the info (billing codes)
from the customfieldvalues table where the ID of the custom field I am
using is 1. Since this is a field that has a parent/child
relationship, this creates an option group heading with the selectable
fields in the drop down box under each option group. If you have just
one field and no relationships, it is much more simple. This requires
a database connection string which is in a file outside of my web
directory. I know this may not be exactly what you are looking for,
but the main part you are asking about I believe the part you are
looking for specifically is down at the end of building the message
where the custom fields are pushed into the email with commandbymail.
Note, I found out the custom fields could NOT have any spaces in them
for commandbymail to function. I hope this helps and is not too
confusing. I am quite sure some of this could be done more
efficiently. I am not a developer. I have a good understanding of
php, but not always the most efficient way.

—connection_file—

<?php $host = "database_server"; $user = "postgres"; $pass = "dbpassword"; $db = "rtdb"; $conn_rtdb = pg_connect("host=$host dbname=$db user=$user password=$pass") or die("Couldn't Connect to $db".pg_last_error()); ?>

—connection_file—
—ticket_form—

<?php //set page action based on how the user gets to the page (sendMail or showForm) $action = $_REQUEST['action']; global $action; ---form_code--- function showForm() { include('/path/to/connection_file'); $getclientproject = pg_query($conn_rtdb, "select name from customfieldvalues where customfield=1 order by name")or die("Get ClientProject " . pg_last_error()); $fields=pg_num_fields($getclientproject); echo "Task Code"; echo "Select..."; for ($i=0; $i < pg_num_fields($getclientproject); $i++) while ($row = pg_fetch_row($getclientproject)) { for ($f=0; $f < $fields; $f++) { echo "$row[$f]"; $gettaskcodes = pg_query($conn_rtdb, "select c.name from customfieldvalues a,attributes b,customfieldvalues c where a.name=b.content and b.objectid=c.id and b.content='$row[$f]' order by c.name,c.sortorder")or die("Get Codes ".pg_last_error()); $fields=pg_num_fields($gettaskcodes); for ($i=0; $i < pg_num_fields($gettaskcodes); $i++) while ($row = pg_fetch_row($gettaskcodes)) { for ($f=0; $f < $fields; $f++) { echo "$row[$f]"; echo ""; }} echo ""; }} echo ""; } //end action showForm ?>

—form_code—

Then I gather the form data to be pushed into RT as an email. I use
the commandbymail plugin to allow fields to be populated via email.
Then I build the email with PHP code to send to RT:

—form_submit—

<?php function sendMail() { include("/path/to/connection_file"); // Gather form data... each item that is pulled had its own field in the web form $to = $_REQUEST['sendto'] ; //whatever queue they chose in a dropdown box on the web form $from = "$_REQUEST['from_email']" ; $project = $_REQUEST['Project'] ; $priority = $_REQUEST['Priority'] ; $duedate = $_REQUEST['duedate'] ; $time = $_REQUEST['time'] ; $taskcode = $_REQUEST['taskcode'] ; $admincc = $_REQUEST['AdminCC'] ; //Get client project from RT database $getcp = pg_query($conn_rtdb, "select a.content from attributes a, customfieldvalues b where b.name='$taskcode' and b.id=a.objectid")or die("Get CP ".pg_last_error()); $rescp = pg_fetch_row($getcp); $cltprj = $rescp[0]; //create due date timestamp, concatenate fields and clean up strange characters $due = $duedate." ".$time ; $subjectdetails = pg_escape_string(stripslashes($_REQUEST['SubjectDetails'])) ; $body = pg_escape_string(stripslashes($_REQUEST['Body'])) ; $subject = $project.": " . $subjectdetails ; //Build data to be pushed into ticket for commandbymail $fields = array(); $fields{"Project"} = "Project"; $fields{"SubjectDetails"} = "Subject"; $fields{"Body"} = "Message"; foreach($fields as $a => $b) { $bodymessage .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); } //Build message headers $headers = "From: $from\n"; $headers .= "Reply-To: $from\n"; $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-Type: multipart/related; type=\"multipart/alternative\"; boundary=\"----=MIME_BOUNDRY_main_message\"\n"; $headers .= "X-Sender: $from\n"; $headers .= "X-Mailer: PHP4\n"; $headers .= "X-Priority: 3\n"; //1 = Urgent, 3 = Nmrmal $headers .= "Return-Path: <" . $_POST['Email'] . ">\n"; $headers .= "This is a multi-part message in MIME format.\n"; $headers .= "------=MIME_BOUNDRY_main_message \n"; $headers .= "Content-Type: multipart/alternative; boundary=\"----=MIME_BOUNDRY_message_parts\"\n"; //Build message contents $message = "------=MIME_BOUNDRY_message_parts\n"; $message .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n"; $message .= "Content-Transfer-Encoding: quoted-printable\n"; $message .= "\n"; /* Add custom message, in this case it's plain text. You could also add HTML by changing the Content-Type to text/html */ $message .= "Due: ".$duedate." ".$time."\n"; $message .= "Priority: ".$priority."\n"; if($admincc != 'none'){ $message .= "AdminCc: ".$admincc."\n"; } $message .= "CustomField.{Client_Project}: ".$cltprj."\n"; $message .= "CustomField.{Task_Code}: ".$taskcode."\n"; $message .= "CustomField.{Category}: ".$category."\n"; $message .= "\n"; $message .= "$bodymessage\n"; $message .= "\n"; $message .= "------=MIME_BOUNDRY_message_parts--\n"; $message .= "\n"; //Send message $ok = mail($to, $subject, $message, $headers); if($ok == 1) { echo "Your ticket has been sent."; } else { print "We encountered an error sending your mail, please notify the RT administrator"; } } ?. //Determine what state the form is in when the user gets to it <?php switch ($action) { case "send": sendMail(); showForm(); break; default: showForm(); } ?>

Ahh. I see what you’re asking now. Wish I could offer more.On Feb 6, 2012, at 7:34 AM, Jim Lesinski jim.lesinski@gmail.com wrote:

Hi Joe, that’s good information but I am looking to be able to use the web service to populate the autocomplete values for one specific RT CustomField within RT. When you are setting up a custom field the screen even says that you can use a web service to populate the field’s values, but I am not sure how to do that and I cannot find documentation.

Thanks,
Jim Lesinski

On Feb 6, 2012, at 7:19 AM, Joe Harris drey111@gmail.com wrote:

I am looking at rt-4.0.5 and it seems that you can tie a custom field into a
web service.

I created a PHP web form to try and drive requestors to put in the
proper information. What I provided was a drop down box to show
custom fields pulled from the RT database and then build a email to be
sent to the queue the user chose.

Is there any documentation about using a webservice or does someone have an
example of its use? Or if someone has details about doing something like I
described above using another method I’d love to hear about that too.

The following is the PHP code I used to pull the info (billing codes)
from the customfieldvalues table where the ID of the custom field I am
using is 1. Since this is a field that has a parent/child
relationship, this creates an option group heading with the selectable
fields in the drop down box under each option group. If you have just
one field and no relationships, it is much more simple. This requires
a database connection string which is in a file outside of my web
directory. I know this may not be exactly what you are looking for,
but the main part you are asking about I believe the part you are
looking for specifically is down at the end of building the message
where the custom fields are pushed into the email with commandbymail.
Note, I found out the custom fields could NOT have any spaces in them
for commandbymail to function. I hope this helps and is not too
confusing. I am quite sure some of this could be done more
efficiently. I am not a developer. I have a good understanding of
php, but not always the most efficient way.

—connection_file—

<?php $host = "database_server"; $user = "postgres"; $pass = "dbpassword"; $db = "rtdb"; $conn_rtdb = pg_connect("host=$host dbname=$db user=$user password=$pass") or die("Couldn't Connect to $db".pg_last_error()); ?>

—connection_file—
—ticket_form—

<?php //set page action based on how the user gets to the page (sendMail or showForm) $action = $_REQUEST['action']; global $action; ---form_code--- function showForm() { include('/path/to/connection_file'); $getclientproject = pg_query($conn_rtdb, "select name from customfieldvalues where customfield=1 order by name")or die("Get ClientProject " . pg_last_error()); $fields=pg_num_fields($getclientproject); echo "Task Code"; echo "Select..."; for ($i=0; $i < pg_num_fields($getclientproject); $i++) while ($row = pg_fetch_row($getclientproject)) { for ($f=0; $f < $fields; $f++) { echo "$row[$f]"; $gettaskcodes = pg_query($conn_rtdb, "select c.name from customfieldvalues a,attributes b,customfieldvalues c where a.name=b.content and b.objectid=c.id and b.content='$row[$f]' order by c.name,c.sortorder")or die("Get Codes ".pg_last_error()); $fields=pg_num_fields($gettaskcodes); for ($i=0; $i < pg_num_fields($gettaskcodes); $i++) while ($row = pg_fetch_row($gettaskcodes)) { for ($f=0; $f < $fields; $f++) { echo "$row[$f]"; echo ""; }} echo ""; }} echo ""; } //end action showForm ?>

—form_code—

Then I gather the form data to be pushed into RT as an email. I use
the commandbymail plugin to allow fields to be populated via email.
Then I build the email with PHP code to send to RT:

—form_submit—

<?php function sendMail() { include("/path/to/connection_file"); // Gather form data... each item that is pulled had its own field in the web form $to = $_REQUEST['sendto'] ; //whatever queue they chose in a dropdown box on the web form $from = "$_REQUEST['from_email']" ; $project = $_REQUEST['Project'] ; $priority = $_REQUEST['Priority'] ; $duedate = $_REQUEST['duedate'] ; $time = $_REQUEST['time'] ; $taskcode = $_REQUEST['taskcode'] ; $admincc = $_REQUEST['AdminCC'] ; //Get client project from RT database $getcp = pg_query($conn_rtdb, "select a.content from attributes a, customfieldvalues b where b.name='$taskcode' and b.id=a.objectid")or die("Get CP ".pg_last_error()); $rescp = pg_fetch_row($getcp); $cltprj = $rescp[0]; //create due date timestamp, concatenate fields and clean up strange characters $due = $duedate." ".$time ; $subjectdetails = pg_escape_string(stripslashes($_REQUEST['SubjectDetails'])) ; $body = pg_escape_string(stripslashes($_REQUEST['Body'])) ; $subject = $project.": " . $subjectdetails ; //Build data to be pushed into ticket for commandbymail $fields = array(); $fields{"Project"} = "Project"; $fields{"SubjectDetails"} = "Subject"; $fields{"Body"} = "Message"; foreach($fields as $a => $b) { $bodymessage .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); } //Build message headers $headers = "From: $from\n"; $headers .= "Reply-To: $from\n"; $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-Type: multipart/related; type=\"multipart/alternative\"; boundary=\"----=MIME_BOUNDRY_main_message\"\n"; $headers .= "X-Sender: $from\n"; $headers .= "X-Mailer: PHP4\n"; $headers .= "X-Priority: 3\n"; //1 = Urgent, 3 = Nmrmal $headers .= "Return-Path: <" . $_POST['Email'] . ">\n"; $headers .= "This is a multi-part message in MIME format.\n"; $headers .= "------=MIME_BOUNDRY_main_message \n"; $headers .= "Content-Type: multipart/alternative; boundary=\"----=MIME_BOUNDRY_message_parts\"\n"; //Build message contents $message = "------=MIME_BOUNDRY_message_parts\n"; $message .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n"; $message .= "Content-Transfer-Encoding: quoted-printable\n"; $message .= "\n"; /* Add custom message, in this case it's plain text. You could also add HTML by changing the Content-Type to text/html */ $message .= "Due: ".$duedate." ".$time."\n"; $message .= "Priority: ".$priority."\n"; if($admincc != 'none'){ $message .= "AdminCc: ".$admincc."\n"; } $message .= "CustomField.{Client_Project}: ".$cltprj."\n"; $message .= "CustomField.{Task_Code}: ".$taskcode."\n"; $message .= "CustomField.{Category}: ".$category."\n"; $message .= "\n"; $message .= "$bodymessage\n"; $message .= "\n"; $message .= "------=MIME_BOUNDRY_message_parts--\n"; $message .= "\n"; //Send message $ok = mail($to, $subject, $message, $headers); if($ok == 1) { echo "Your ticket has been sent."; } else { print "We encountered an error sending your mail, please notify the RT administrator"; } } ?. //Determine what state the form is in when the user gets to it <?php switch ($action) { case "send": sendMail(); showForm(); break; default: showForm(); } ?>

Hi Joe, that’s good information but I am looking to be able to use
the web service to populate the autocomplete values for one
specific RT CustomField within RT. When you are setting up a custom
field the screen even says that you can use a web service to
populate the field’s values, but I am not sure how to do that and I
cannot find documentation.

Thanks, Jim Lesinski

Jim,

I believe you’ve misread the RT CustomField definition screen.
I’ve never used this feature before, but I read and interpret
it as follows:

It says (emphasis mine):

 RT can make this *custom field's values into hyperlinks to
 another service*. Fill in this field with a URL. RT will
 replace __id__ and __CustomField__ with the record's id
 and the custom field's value, respectively.

Let’s say your CF is “Employee Number”.

So, if you set “Link values to” as:

 http://service.example.com/lookup?empnum=__CustomField__

If I typed ‘430’ into this CF as a value (as an end user),
it would show as a clickable link:

 http://service.example.com/lookup?empnum=430

Jeff Blaine

There seems to be a lot of confusion about what I am asking. I am sorry if
I am not making myself clear. Please check out the attached image which
shows exactly what I am looking at. Maybe I am interpreting it wrong, but
the field Jeff describes is not the one I am asking about. I am referring
to the field below it called “Include Page” which states:

“RT can include content from another web service when showing this custom
field. Fill in this field with a URL. RT will replace id and
CustomField with the record’s id and the custom field’s value,
respectively. Some browsers may only load content from the same domain as
your RT server.”

This seems to imply to me that the custom field can in fact include values
from a web service. Or does this mean that it can render content in an
iFrame or something? If someone can clarify what that field does I think
that would be all I need.On Mon, Feb 6, 2012 at 9:10 AM, Jeff Blaine jblaine@kickflop.net wrote:

On Feb 6, 2012, at 7:34 AM, Jim Lesinski<jim.lesinski@gmail.**comjim.lesinski@gmail.com wrote:

Hi Joe, that’s good information but I am looking to be able to use

the web service to populate the autocomplete values for one
specific RT CustomField within RT. When you are setting up a custom
field the screen even says that you can use a web service to
populate the field’s values, but I am not sure how to do that and I
cannot find documentation.

Thanks, Jim Lesinski

Jim,

I believe you’ve misread the RT CustomField definition screen.
I’ve never used this feature before, but I read and interpret
it as follows:

It says (emphasis mine):

RT can make this custom field’s values into hyperlinks to
another service
. Fill in this field with a URL. RT will
replace id and CustomField with the record’s id
and the custom field’s value, respectively.

Let’s say your CF is “Employee Number”.

So, if you set “Link values to” as:

http://service.example.com/**lookup?empnum=__CustomField__http://service.example.com/lookup?empnum=__CustomField__

If I typed ‘430’ into this CF as a value (as an end user),
it would show as a clickable link:

http://service.example.com/**lookup?empnum=430http://service.example.com/lookup?empnum=430

Jeff Blaine

RT Training Sessions (http://bestpractical.com/**services/training.htmlhttp://bestpractical.com/services/training.html
)

  • Boston March 5 & 6, 2012

There seems to be a lot of confusion about what I am asking. I am sorry if I am not making
myself clear. Please check out the attached image which shows exactly what I am looking at.
Maybe I am interpreting it wrong, but the field Jeff describes is not the one I am asking
about. I am referring to the field below it called “Include Page” which states:

“RT can include content from another web service when showing this custom field. Fill in this
field with a URL. RT will replace id and CustomField with the record’s id and the
custom field’s value, respectively. Some browsers may only load content from the same domain
as your RT server.”
This seems to imply to me that the custom field can in fact include values from a web service.
Or does this mean that it can render content in an iFrame or something? If someone can clarify
what that field does I think that would be all I need.

This means that you can render content into an iframe using the value
of the custom field.

If your user selected “Foo” from a custom field, RT can make a call to
an external webservice with Foo and some other information and then
iframe the data into Ticket/Display.html (assuming you don’t violate
any of the security restrictions on iframes).

If you want to control the values of a custom field, you will need to
read the docs/extending/external_custom_fields.pod document you
referenced earlier.

-kevin

Thanks Kevin. I did in fact misinterpret the meaning of the field then as I
thought it meant to fill the drop down values from a web service. I didn’t
realize it was referring to an iFrame.On Mon, Feb 6, 2012 at 4:42 PM, Kevin Falcone falcone@bestpractical.comwrote:

On Mon, Feb 06, 2012 at 11:32:47AM -0500, Jim Lesinski wrote:

There seems to be a lot of confusion about what I am asking. I am
sorry if I am not making
myself clear. Please check out the attached image which shows exactly
what I am looking at.
Maybe I am interpreting it wrong, but the field Jeff describes is not
the one I am asking
about. I am referring to the field below it called “Include Page”
which states:

“RT can include content from another web service when showing this
custom field. Fill in this
field with a URL. RT will replace id and CustomField with the
record’s id and the
custom field’s value, respectively. Some browsers may only load
content from the same domain
as your RT server.”
This seems to imply to me that the custom field can in fact include
values from a web service.
Or does this mean that it can render content in an iFrame or
something? If someone can clarify
what that field does I think that would be all I need.

This means that you can render content into an iframe using the value
of the custom field.

If your user selected “Foo” from a custom field, RT can make a call to
an external webservice with Foo and some other information and then
iframe the data into Ticket/Display.html (assuming you don’t violate
any of the security restrictions on iframes).

If you want to control the values of a custom field, you will need to
read the docs/extending/external_custom_fields.pod document you
referenced earlier.

-kevin


RT Training Sessions (http://bestpractical.com/services/training.html)

  • Boston — March 5 & 6, 2012

This means that you can render content into an iframe using the value
of the custom field.

If your user selected “Foo” from a custom field, RT can make a call to
an external webservice with Foo and some other information and then
iframe the data into Ticket/Display.html (assuming you don’t violate
any of the security restrictions on iframes).

Custom Fields which include content from a URL don’t use an iframe; they
make an ajax request and insert the resulting HTML into the page.
Unlike the iframe approach, the ajax approach requires cross domain
policies to be in place if you’re fetching a url on another domain.

To get around the cross-domain restriction, you can either write a shim
residing on the same host as RT that proxies the request/response, or
implement the cross-origin resource sharing headers
(Cross-origin resource sharing - Wikipedia).

Thomas