Need to display value of field from RNT onto the ask page

Hi All,

I need to obtain the value of a field for a particular incident with ref. no. specified and display it on the ask page. I have been trying on this but have been unable to. Does anyone here know how this can be done ? Any pointers will be greatly appreciated.

Thanks,

J

Comments

Yes

There is a widget available for displaying data (standard/output/DataDisplay) but from the little you revealed about your specific use case I'm guessing it won't work.

That would leave you with using Connect PHP to query the Incidents table, retrieve the object, then 'print/echo' out the results. You could run this PHP directly inline on the ask.php page, but it would probably be more appropriate to wrap this code in a a widget; not for a technical reason, but for better code organization and best practice adherence.

Docs for ConnectPHP can be found here:
http://documentation.custhelp.com/euf/assets/devdocs/february2015/Connect_PHP/Default.htm

Your PHP code will look something like this:


try
{
  //assume ref no as $refno
  $incident = \RightNow\Connect\v1_2\Incident::first(sprintf("ReferenceNumber = '%s'", $refno));
  echo $incident->Name->First; //Standard Field
  echo $incident->CustomFields->c->my_custom_field; //Sample Custom Field
} catch(\Exception $ex){}

Hi Andy, Thanks for the reply. I tried using the standard/output/DataDisplay widget but am unable to get the widget to display the value of a particular incident. The widget only has a name attribute where I can specify the table and field in the form tables.c$field but no further attribute to specify the object ID. How do I then get information of a specific incident with ref. no. xxxxxx-xxxxxx ? Thanks, J

Hi Andy,

Thanks for the reply. I tried using the standard/output/DataDisplay widget but am unable to get the widget to display the value of a particular incident. The widget only has a name attribute where I can specify the table and field in the form tables.c$field but no further attribute to specify the object ID. How do I then get information of a specific incident with ref. no. xxxxxx-xxxxxx ?

Thanks,

J

Those widgets take their context from a url parameter. In the case of incidents, that URL parameter is i_id/XXX where XXX is the Incident ID. This is NOT the Incident Reference number.

The system will not let you enter an i_id parameter value for an incident that isn't owned by the logged in contact. If your use case is outside of this very narrow behavior, you'll have to resort to custom code.

Zircon - This is a contributing Drupal Theme
Design by WeebPal.