handlers/kinetic_request_answers_all_retrieve_v2/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()
    qual = %|'CustomerSurveyInstanceId' = "#{@parameters['Submission ID']}" OR 'CustomerSurveyID' = "#{@parameters['Submission ID']}"|
    entries = @@remedy_forms['KS_SRV_CustomerSurveyQuestionAnswerJoin'].find_entries(
      :all,
      :conditions => [qual],
      :fields => ['QuestioninstanceId', 'Question', 'FullAnswer', 'Answer_Data_Type']
      )
    question_results = ""
    if !entries.nil? then
      entries.each {|entry| 
		if !entry['FullAnswer'].nil?
			if entry['FullAnswer'].bytesize > 3998
			qual1 = %|'CustomerSurveyInstanceID' = "#{@parameters['Submission ID']}" AND 'QuestionInstanceID' = "#{entry['QuestioninstanceId']}"|
			puts("Searching for unlimited answer ") if @debug_logging_enabled
			answerEntry = @@remedy_forms['KS_SRV_SurveyAnswerUnlimited'].find_entries(
			  :single,
			  :conditions => [qual1],
			  :fields => ['UnlimitedlAnswer']
			  )
				if answerEntry.nil?
								puts("Did not find unlimited answer ") if @debug_logging_enabled
								question_results << %|<result name="#{escape(entry['Question'])}">#{escape(entry['FullAnswer'])}</result>|
				else
								puts("Found unlimited answer ") if @debug_logging_enabled
								question_results << %|<result name="#{escape(entry['Question'])}">#{escape(answerEntry['UnlimitedlAnswer'])}</result>|
				end
			else
				question_results << %|<result name="#{escape(entry['Question'])}">#{escape(entry['FullAnswer'])}</result>|
			end
		else
			question_results << %|<result name="#{escape(entry['Question'])}">#{escape(entry['FullAnswer'])}</result>|
		end
      }
    end
    results = <<-RESULTS
    <results>
      #{question_results}
    </results>
    RESULTS
  end
def execute ( ) qual = %|'CustomerSurveyInstanceId' = "#{@parameters['Submission ID']}" OR 'CustomerSurveyID' = "#{@parameters['Submission ID']}"| entries = @@remedy_forms [ 'KS_SRV_CustomerSurveyQuestionAnswerJoin' ] . find_entries ( :all , :conditions => [ qual ] , :fields => [ 'QuestioninstanceId' , 'Question' , 'FullAnswer' , 'Answer_Data_Type' ] ) question_results = "" if ! entries . nil? then entries . each { | entry | if ! entry [ 'FullAnswer' ] . nil? if entry [ 'FullAnswer' ] . bytesize > 3998 qual1 = %|'CustomerSurveyInstanceID' = "#{@parameters['Submission ID']}" AND 'QuestionInstanceID' = "#{entry['QuestioninstanceId']}"| puts ( "Searching for unlimited answer " ) if @debug_logging_enabled answerEntry = @@remedy_forms [ 'KS_SRV_SurveyAnswerUnlimited' ] . find_entries ( :single , :conditions => [ qual1 ] , :fields => [ 'UnlimitedlAnswer' ] ) if answerEntry . nil? puts ( "Did not find unlimited answer " ) if @debug_logging_enabled question_results << %|<result name="#{escape(entry['Question'])}">#{escape(entry['FullAnswer'])}</result>| else puts ( "Found unlimited answer " ) if @debug_logging_enabled question_results << %|<result name="#{escape(entry['Question'])}">#{escape(answerEntry['UnlimitedlAnswer'])}</result>| end else question_results << %|<result name="#{escape(entry['Question'])}">#{escape(entry['FullAnswer'])}</result>| end else question_results << %|<result name="#{escape(entry['Question'])}">#{escape(entry['FullAnswer'])}</result>| end } end results = <<-RESULTS 
    <results>
       #{ question_results } 
    </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 .
# Retrieve the KS_SRV_CustomerSurveyQuestionAnswerJoin value for the specified Request and Question.   #need to check if need to search for unlimited answer # Return the results