handlers/kinetic_request_submission_dataset_retrieve_v2/handler/init.rb
# Creates a record in the KS_SRV_Helper form
#
# This is a required method that is automatically called by the Kinetic Task
# Engine.
#
# ==== Returns
# An Xml formatted String representing the return variable results.
Creates a record in the KS_SRV_Helper form
This is a required method that is automatically called by the Kinetic Task
Engine.

Returns
An Xml formatted String representing the return variable results.
Creates a record in the KS_SRV_Helper form 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()
    base_record = @@remedy_forms['KS_SRV_CustomerSurvey'].find_entries(
      :single,
      :conditions => [%|'CustomerSurveyInstanceId' = "#{@parameters['Submission ID']}" OR 'CustomerSurveyID' = "#{@parameters['Submission ID']}"|],
      :fields => :all
    )
    raise "Unable to find KS_SRV_CustomerSurvey record with CustomerSurvey ID or instanceId of: #{@parameters['Submission ID']}" if base_record.nil?
	if (@taskVersion == "3")
	 template_record = Records::Template.new(base_record)
	 @dataset_hash = Records::TemplateDataSetMapping.find_all(
		  :data_set => template_record.data_set
		).inject({}) do |hash, mapping_record|
		  field_id = mapping_record.field_id.to_i
		  mapping_field = Records::RequestBase.form.field_for(field_id)
		  unless mapping_field.nil? || mapping_field.entrymode == "DISPLAY_ONLY"
			value = base_record[field_id]
			hash[mapping_record.field_label] = value.respond_to?(:value) ? value.value : value
		  end
		  hash
		end
		 puts(format_hash("Dataset Found: ", @dataset_hash)) if @debug_logging_enabled
	elsif (@taskVersion == "4")
	  template_record = Records::Template.new(base_record, :context => @@remedy_context)
	  @dataset_hash =  Records::TemplateDataSetMapping.find_all(
		  :data_set => template_record.data_set, :context => @@remedy_context
		).inject({}) do |hash, mapping_record|
		  field_id = mapping_record.field_id.to_i
		  mapping_field = Records::RequestBase.form.field_for(field_id)
		  unless mapping_field.nil? || mapping_field.entrymode == "DISPLAY_ONLY"
			value = base_record[field_id]
			hash[mapping_record.field_label] = value.respond_to?(:value) ? value.value : value
		  end
		  hash
		end
		puts(format_hash("Dataset Found: ", @dataset_hash)) if @debug_logging_enabled
	end
    dataset_results = ""    
    @dataset_hash.each_pair {|key, value|
      dataset_results << %|<result name="#{key}">#{escape(value)}</result>|
    }
    <<-RESULTS
    <results>
     #{dataset_results}
    </results>
    RESULTS
  end
def execute ( ) base_record = @@remedy_forms [ 'KS_SRV_CustomerSurvey' ] . find_entries ( :single , :conditions => [ %|'CustomerSurveyInstanceId' = "#{@parameters['Submission ID']}" OR 'CustomerSurveyID' = "#{@parameters['Submission ID']}"| ] , :fields => :all ) raise "Unable to find KS_SRV_CustomerSurvey record with CustomerSurvey ID or instanceId of: #{@parameters['Submission ID']}" if base_record . nil? if ( @taskVersion == "3" ) template_record = Records :: Template . new ( base_record ) @dataset_hash = Records :: TemplateDataSetMapping . find_all ( :data_set => template_record . data_set ) . inject ( { } ) do | hash , mapping_record | field_id = mapping_record . field_id . to_i mapping_field = Records :: RequestBase . form . field_for ( field_id ) unless mapping_field . nil? || mapping_field . entrymode == "DISPLAY_ONLY" value = base_record [ field_id ] hash [ mapping_record . field_label ] = value . respond_to? ( :value ) ? value . value : value end hash end puts ( format_hash ( "Dataset Found: " , @dataset_hash ) ) if @debug_logging_enabled elsif ( @taskVersion == "4" ) template_record = Records :: Template . new ( base_record , :context => @@remedy_context ) @dataset_hash = Records :: TemplateDataSetMapping . find_all ( :data_set => template_record . data_set , :context => @@remedy_context ) . inject ( { } ) do | hash , mapping_record | field_id = mapping_record . field_id . to_i mapping_field = Records :: RequestBase . form . field_for ( field_id ) unless mapping_field . nil? || mapping_field . entrymode == "DISPLAY_ONLY" value = base_record [ field_id ] hash [ mapping_record . field_label ] = value . respond_to? ( :value ) ? value . value : value end hash end puts ( format_hash ( "Dataset Found: " , @dataset_hash ) ) if @debug_logging_enabled end dataset_results = "" @dataset_hash . each_pair { | key , value | dataset_results << %|<result name="#{key}">#{escape(value)}</result>| } <<-RESULTS 
    <results>
      #{ dataset_results } 
    </results>
     RESULTS end
Creates a record in the KS_SRV_Helper form
This is a required method that is automatically called by the Kinetic Task
Engine.
Creates a record in the KS_SRV_Helper form This is a required method that is automatically called by the Kinetic Task Engine .
# Retrieve a single entry from KS_SRV_Helper form #v3 # Build the template record from the KS_SRV_CustomerSurvey record, which # includes the Template fields. # Build the template dataset mappings based on the KS_SRV_DataSet form # records for dataset specified on the current KS_SRV_CustomerSurvey # record. # Define the current KS_SRV_DataSet record's field_id as a Fixnum # Retrieve the ArsModels::Field associated with the current # KS_SRV_CustomerSurvey field. # Unless the field does not exist on the form, or the field is display only # Retrieve the value of the field on the KS_SRV_CustomerSurvey entry # Map the KS_SRV_DataSet record's field label value to the field value # Return the hash to continue injecting # Define the current KS_SRV_DataSet record's field_id as a Fixnum # Retrieve the ArsModels::Field associated with the current # KS_SRV_CustomerSurvey field. # Unless the field does not exist on the form, or the field is display only # Retrieve the value of the field on the KS_SRV_CustomerSurvey entry # Map the KS_SRV_DataSet record's field label value to the field value # Return the hash to continue injecting