handlers/kinetic_tabular_data_retrieve_v4/handler/init.rb
# Uses the Instance ID to retrieve a single entry from the KS:FRB_TableData_base 
# form.  The purpose of this is to return data elements associated
# to the entry found.
#
# This is a required method that is automatically called by the Kinetic Task
# Engine.
#
# ==== Returns
# An Xml formatted String representing the return variable results.
Uses the Instance ID to retrieve a single entry from the KS:FRB_TableData_base
form.  The purpose of this is to return data elements associated
to the entry found.

This is a required method that is automatically called by the Kinetic Task
Engine.

Returns
An Xml formatted String representing the return variable results.
Uses the Instance ID to retrieve a single entry from the KS : FRB_TableData_base form . The purpose of this is to return data elements associated to the entry found . This is a required method that is automatically called by the Kinetic Task Engine . Returns An Xml formatted String representing the return variable results .
def execute()
    entry = @@remedy_forms['CUSTOM:KS_SRV_TableData_base'].find_entries(
      :single,
      :conditions => [%|'179' = "#{@parameters['instance_id']}"|],
      :fields => :all
    )
	raise("No matching entry on the CUSTOM:KS_SRV_TableData_base form for the given instance id [#{@parameters['instance_id']}]") if entry.nil?
    field_values = entry.field_values.collect do |field_id, value|
      "#{@@remedy_forms['CUSTOM:KS_SRV_TableData_base'].field_for(field_id).name}: #{value}"
    end
	puts("Field Values: #{field_values.inspect}") if @debug_logging_enabled	
    results = <<-RESULTS
    <results>
      <result name="CustomerSurveyInstanceID">#{escape(entry['CustomerSurveyInstanceID'])}</result>
      <result name="Survey_Template_Name">#{escape(entry['Survey_Template_Name'])}</result>
      <result name="Table Name">#{escape(entry['Table Name'])}</result>
      <result name="Label1">#{escape(entry['Label1'])}</result>
      <result name="Value1">#{escape(entry['Value1'])}</result>
      <result name="Label2">#{escape(entry['Label2'])}</result>
      <result name="Value2">#{escape(entry['Value2'])}</result>
      <result name="Label3">#{escape(entry['Label3'])}</result>
      <result name="Value3">#{escape(entry['Value3'])}</result>
      <result name="Label4">#{escape(entry['Label4'])}</result>
      <result name="Value4">#{escape(entry['Value4'])}</result>
      <result name="Label5">#{escape(entry['Label5'])}</result>
      <result name="Value5">#{escape(entry['Value5'])}</result>
      <result name="Label6">#{escape(entry['Label6'])}</result>
      <result name="Value6">#{escape(entry['Value6'])}</result>
      <result name="Label7">#{escape(entry['Label7'])}</result>
      <result name="Value7">#{escape(entry['Value7'])}</result>
      <result name="Label8">#{escape(entry['Label8'])}</result>
      <result name="Value8">#{escape(entry['Value8'])}</result>
      <result name="Label9">#{escape(entry['Label9'])}</result>
      <result name="Value9">#{escape(entry['Value9'])}</result>
      <result name="Label10">#{escape(entry['Label10'])}</result>
      <result name="Value10">#{escape(entry['Value10'])}</result>
      <result name="Label11">#{escape(entry['Label11'])}</result>
      <result name="Value11">#{escape(entry['Value11'])}</result>
      <result name="Label12">#{escape(entry['Label12'])}</result>
      <result name="Value12">#{escape(entry['Value12'])}</result>
      <result name="Label13">#{escape(entry['Label13'])}</result>
      <result name="Value13">#{escape(entry['Value13'])}</result>
      <result name="Label14">#{escape(entry['Label14'])}</result>
      <result name="Value14">#{escape(entry['Value14'])}</result>
      <result name="Label15">#{escape(entry['Label15'])}</result>
      <result name="Value15">#{escape(entry['Value15'])}</result>
      <result name="Label16">#{escape(entry['Label16'])}</result>
      <result name="Value16">#{escape(entry['Value16'])}</result>
      <result name="Label17">#{escape(entry['Label17'])}</result>
      <result name="Value17">#{escape(entry['Value17'])}</result>
	  <result name="Label18">#{escape(entry['Label18'])}</result>
      <result name="Value18">#{escape(entry['Value18'])}</result>
      <result name="Label19">#{escape(entry['Label19'])}</result>
      <result name="Value19">#{escape(entry['Value19'])}</result>
      <result name="Label20">#{escape(entry['Label20'])}</result>
      <result name="Value20">#{escape(entry['Value20'])}</result>
	</results>
    RESULTS
	puts(results) if @debug_logging_enabled	
    return results
  end
def execute ( ) entry = @@remedy_forms [ 'CUSTOM:KS_SRV_TableData_base' ] . find_entries ( :single , :conditions => [ %|'179' = "#{@parameters['instance_id']}"| ] , :fields => :all ) raise ( "No matching entry on the CUSTOM:KS_SRV_TableData_base form for the given instance id [#{@parameters['instance_id']}]" ) if entry . nil? field_values = entry . field_values . collect do | field_id , value | "#{@@remedy_forms['CUSTOM:KS_SRV_TableData_base'].field_for(field_id).name}: #{value}" end puts ( "Field Values: #{field_values.inspect}" ) if @debug_logging_enabled results = <<-RESULTS 
    <results>
      <result name="CustomerSurveyInstanceID"> #{ escape ( entry [ 'CustomerSurveyInstanceID' ] ) } </result>
      <result name="Survey_Template_Name"> #{ escape ( entry [ 'Survey_Template_Name' ] ) } </result>
      <result name="Table Name"> #{ escape ( entry [ 'Table Name' ] ) } </result>
      <result name="Label1"> #{ escape ( entry [ 'Label1' ] ) } </result>
      <result name="Value1"> #{ escape ( entry [ 'Value1' ] ) } </result>
      <result name="Label2"> #{ escape ( entry [ 'Label2' ] ) } </result>
      <result name="Value2"> #{ escape ( entry [ 'Value2' ] ) } </result>
      <result name="Label3"> #{ escape ( entry [ 'Label3' ] ) } </result>
      <result name="Value3"> #{ escape ( entry [ 'Value3' ] ) } </result>
      <result name="Label4"> #{ escape ( entry [ 'Label4' ] ) } </result>
      <result name="Value4"> #{ escape ( entry [ 'Value4' ] ) } </result>
      <result name="Label5"> #{ escape ( entry [ 'Label5' ] ) } </result>
      <result name="Value5"> #{ escape ( entry [ 'Value5' ] ) } </result>
      <result name="Label6"> #{ escape ( entry [ 'Label6' ] ) } </result>
      <result name="Value6"> #{ escape ( entry [ 'Value6' ] ) } </result>
      <result name="Label7"> #{ escape ( entry [ 'Label7' ] ) } </result>
      <result name="Value7"> #{ escape ( entry [ 'Value7' ] ) } </result>
      <result name="Label8"> #{ escape ( entry [ 'Label8' ] ) } </result>
      <result name="Value8"> #{ escape ( entry [ 'Value8' ] ) } </result>
      <result name="Label9"> #{ escape ( entry [ 'Label9' ] ) } </result>
      <result name="Value9"> #{ escape ( entry [ 'Value9' ] ) } </result>
      <result name="Label10"> #{ escape ( entry [ 'Label10' ] ) } </result>
      <result name="Value10"> #{ escape ( entry [ 'Value10' ] ) } </result>
      <result name="Label11"> #{ escape ( entry [ 'Label11' ] ) } </result>
      <result name="Value11"> #{ escape ( entry [ 'Value11' ] ) } </result>
      <result name="Label12"> #{ escape ( entry [ 'Label12' ] ) } </result>
      <result name="Value12"> #{ escape ( entry [ 'Value12' ] ) } </result>
      <result name="Label13"> #{ escape ( entry [ 'Label13' ] ) } </result>
      <result name="Value13"> #{ escape ( entry [ 'Value13' ] ) } </result>
      <result name="Label14"> #{ escape ( entry [ 'Label14' ] ) } </result>
      <result name="Value14"> #{ escape ( entry [ 'Value14' ] ) } </result>
      <result name="Label15"> #{ escape ( entry [ 'Label15' ] ) } </result>
      <result name="Value15"> #{ escape ( entry [ 'Value15' ] ) } </result>
      <result name="Label16"> #{ escape ( entry [ 'Label16' ] ) } </result>
      <result name="Value16"> #{ escape ( entry [ 'Value16' ] ) } </result>
      <result name="Label17"> #{ escape ( entry [ 'Label17' ] ) } </result>
      <result name="Value17"> #{ escape ( entry [ 'Value17' ] ) } </result>
	  <result name="Label18"> #{ escape ( entry [ 'Label18' ] ) } </result>
      <result name="Value18"> #{ escape ( entry [ 'Value18' ] ) } </result>
      <result name="Label19"> #{ escape ( entry [ 'Label19' ] ) } </result>
      <result name="Value19"> #{ escape ( entry [ 'Value19' ] ) } </result>
      <result name="Label20"> #{ escape ( entry [ 'Label20' ] ) } </result>
      <result name="Value20"> #{ escape ( entry [ 'Value20' ] ) } </result>
	</results>
     RESULTS puts ( results ) if @debug_logging_enabled return results end
Uses the Instance ID to retrieve a single entry from the KS:FRB_TableData_base
form.
Uses the Instance ID to retrieve a single entry from the KS : FRB_TableData_base form .
# Retrieve a single entry from KS:FRB_TableData_base based on Remedy Login ID # Raise error if unable to locate the entry # Build up a list of all field names and values for this record # Build the results to be returned by this handler # Return the results String