handlers/kinetic_request_answer_retrieve_v4/handler/init.rb
# The execute method takes no parameters and should leverage the instance
# variables setup and validated by the initialize method to generate a result
# xml string.
The execute method takes no parameters and should leverage the instance
variables setup and validated by the initialize method to generate a result
xml string.
The execute method takes no parameters and should leverage the instance variables setup and validated by the initialize method to generate a result xml string .
def execute()
 	base_entry = get_base_record(@parameters['SubmissionInstanceID'])
    question_entry = get_question(@parameters['TemplateName'],@parameters['QuestionName'], base_entry['SurveyInstanceID'])
    qual = %|'700001890' = "#{question_entry['instanceId']}" AND '700001850' = "#{@parameters['SubmissionInstanceID']}"|
    entry = @@remedy_forms['KS_SRV_SurveyAnswer'].find_entries(
      :single,
      :conditions => [qual],
      :fields => :all
      )
    if entry.nil?
      answer_value = ""
    else
	  if entry['FullAnswer'].nil?	
		answer_value = escape(entry['FullAnswer'])
	  elsif entry['FullAnswer'].bytesize < 3998
		answer_value = escape(entry['FullAnswer'])
	  else
		entryUnlimited = @@remedy_forms['KS_SRV_SurveyAnswerUnlimited'].find_entries(
		  :single,
		  :conditions => [qual],
		  :fields => :all
		  )
		if entryUnlimited.nil?
			answer_value = escape(entry['FullAnswer'])
		else
			answer_value = escape(entryUnlimited['UnlimitedlAnswer'])
		end
	  end
    end      
	puts("Returning #{answer_value}.") if @debug_logging_enabled
    results = <<-RESULTS
    <results>
      <result name="Value">#{answer_value}</result>
    </results>
    RESULTS
 end
def execute ( ) base_entry = get_base_record ( @parameters [ 'SubmissionInstanceID' ] ) question_entry = get_question ( @parameters [ 'TemplateName' ] , @parameters [ 'QuestionName' ] , base_entry [ 'SurveyInstanceID' ] ) qual = %|'700001890' = "#{question_entry['instanceId']}" AND '700001850' = "#{@parameters['SubmissionInstanceID']}"| entry = @@remedy_forms [ 'KS_SRV_SurveyAnswer' ] . find_entries ( :single , :conditions => [ qual ] , :fields => :all ) if entry . nil? answer_value = "" else if entry [ 'FullAnswer' ] . nil? answer_value = escape ( entry [ 'FullAnswer' ] ) elsif entry [ 'FullAnswer' ] . bytesize < 3998 answer_value = escape ( entry [ 'FullAnswer' ] ) else entryUnlimited = @@remedy_forms [ 'KS_SRV_SurveyAnswerUnlimited' ] . find_entries ( :single , :conditions => [ qual ] , :fields => :all ) if entryUnlimited . nil? answer_value = escape ( entry [ 'FullAnswer' ] ) else answer_value = escape ( entryUnlimited [ 'UnlimitedlAnswer' ] ) end end end puts ( "Returning #{answer_value}." ) if @debug_logging_enabled results = <<-RESULTS 
    <results>
      <result name="Value"> #{ answer_value } </result>
    </results>
     RESULTS end
The execute method takes no parameters and should leverage the instance
variables setup and validated by the initialize method to generate a result
xml string.
The execute method takes no parameters and should leverage the instance variables setup and validated by the initialize method to generate a result xml string .
# Get the Question entry associated with the Question Name and Template Name # Retrieve the KS_SRV_SurveyAnswer value for the specified Request and Question. #:all # Check if there was an answer value returned. If no Answer was found, we return nil # rather than throw an error as this allows us to accommodate a nil record at run time. #:all # Return the results