handlers/kinetic_tabular_data_find_v2/handler/init.rb
# Uses the Remedy Login ID to retrieve a single entry from the ITSM v7.x
# CTM:People 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 Remedy Login ID to retrieve a single entry from the ITSM v7.x
CTM:People 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 Remedy Login ID to retrieve a single entry from the ITSM v7 . x CTM : People 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()
	query = ''
	if (@parameters['SurveyInstanceID'])
		query = query + '\'SurveyInstanceID\' = "' +@parameters['SurveyInstanceID'] + '" AND ';
	end
	if (@parameters['Survey_Template_Name'])
		query = query + '\'Survey_Template_Name\' = "' +@parameters['Survey_Template_Name'] + '" AND ';
	end
	if (@parameters['CustomerSurveyInstanceID'])
		query = query + '\'CustomerSurveyInstanceID\' = "' +@parameters['CustomerSurveyInstanceID'] + '" AND ';
	end
	if (@parameters['Table Name'])
		query = query + '\'Table Name\' = "' +@parameters['Table Name'] + '" AND ';
	end
	if (@parameters['Value1'])
		query = query + '\'Value1\' = "' +@parameters['Value1'] + '" AND ';
	end
	if (@parameters['Value2'])
		query = query + '\'Value2\' = "' +@parameters['Value2'] + '" AND ';
	end
	if (@parameters['Value3'])
		query = query + '\'Value3\' = "' +@parameters['Value3'] + '" AND ';
	end
	if (@parameters['Value4'])
		query = query + '\'Value4\' = "' +@parameters['Value4'] + '" AND ';
	end
	if (@parameters['Value5'])
		query = query + '\'Value5\' = "' +@parameters['Value5'] + '" AND ';
	end
	if (@parameters['Value6'])
		query = query + '\'Value6\' = "' +@parameters['Value6'] + '" AND ';
	end
	if (@parameters['Value7'])
		query = query + '\'Value7\' = "' +@parameters['Value7'] + '" AND ';
	end
	if (@parameters['Value8'])
		query = query + '\'Value8\' = "' +@parameters['Value8'] + '" AND ';
	end
	if (@parameters['Value9'])
		query = query + '\'Value9\' = "' +@parameters['Value9'] + '" AND ';
	end
	if (@parameters['Value10'])
		query = query + '\'Value10\' = "' +@parameters['Value10'] + '" AND ';
	end
	if (@parameters['Value11'])
		query = query + '\'Value11\' = "' +@parameters['Value11'] + '" AND ';
	end
	if (@parameters['Value12'])
		query = query + '\'Value12\' = "' +@parameters['Value12'] + '" AND ';
	end
	if (@parameters['Value13'])
		query = query + '\'Value13\' = "' +@parameters['Value13'] + '" AND ';
	end
	if (@parameters['Value14'])
		query = query + '\'Value14\' = "' +@parameters['Value14'] + '" AND ';
	end
	if (@parameters['Value15'])
		query = query + '\'Value15\' = "' +@parameters['Value15'] + '" AND ';
	end
	if (@parameters['Value16'])
		query = query + '\'Value16\' = "' +@parameters['Value16'] + '" AND ';
	end
	if (@parameters['Value17'])
		query = query + '\'Value17\' = "' +@parameters['Value17'] + '" AND ';
	end
	if (@parameters['Value18'])
		query = query + '\'Value18\' = "' +@parameters['Value18'] + '" AND ';
	end
	if (@parameters['Value19'])
		query = query + '\'Value19\' = "' +@parameters['Value19'] + '" AND ';
	end
	if (@parameters['Value20'])
		query = query + '\'Value20\' = "' +@parameters['Value20'] + '" AND ';
	end
	query = query.chomp(' AND ');
	query = query + ''
	raise("No Criteria was entered to search on") if query == ''
	puts(query) if @debug_logging_enabled	
    entry = @@remedy_forms['CUSTOM:KS_SRV_TableData_base'].find_entries(
      :all,
      :conditions => [query],
      :fields => [1,179]
    )
	raise("No matching entry on the CUSTOM:KS_SRV_TableData_base form for the given query [#{query}]") if entry.nil?
	id_list = '<Request_Ids>'
	id_list2 = '<Instance_Ids>'
	entry.each do |entry|
		if (entry[1])
			id_list << '<RequestId>'+ entry[1] +'</RequestId>'
		end
		if (entry[179])
			id_list2 << '<InstanceId>'+ entry[179] +'</InstanceId>'
		end
	end
	id_list << '</Request_Ids>'
	id_list2 << '</Instance_Ids>'
    results = <<-RESULTS
    <results>
		<result name="RequestIdList">#{escape(id_list)}</result>
		<result name="InstanceIdList">#{escape(id_list2)}</result>
    </results>
    RESULTS
	puts(results) if @debug_logging_enabled	
    return results
  end
def execute ( ) query = '' if ( @parameters [ 'SurveyInstanceID' ] ) query = query + '\'SurveyInstanceID\' = "' + @parameters [ 'SurveyInstanceID' ] + '" AND ' ; end if ( @parameters [ 'Survey_Template_Name' ] ) query = query + '\'Survey_Template_Name\' = "' + @parameters [ 'Survey_Template_Name' ] + '" AND ' ; end if ( @parameters [ 'CustomerSurveyInstanceID' ] ) query = query + '\'CustomerSurveyInstanceID\' = "' + @parameters [ 'CustomerSurveyInstanceID' ] + '" AND ' ; end if ( @parameters [ 'Table Name' ] ) query = query + '\'Table Name\' = "' + @parameters [ 'Table Name' ] + '" AND ' ; end if ( @parameters [ 'Value1' ] ) query = query + '\'Value1\' = "' + @parameters [ 'Value1' ] + '" AND ' ; end if ( @parameters [ 'Value2' ] ) query = query + '\'Value2\' = "' + @parameters [ 'Value2' ] + '" AND ' ; end if ( @parameters [ 'Value3' ] ) query = query + '\'Value3\' = "' + @parameters [ 'Value3' ] + '" AND ' ; end if ( @parameters [ 'Value4' ] ) query = query + '\'Value4\' = "' + @parameters [ 'Value4' ] + '" AND ' ; end if ( @parameters [ 'Value5' ] ) query = query + '\'Value5\' = "' + @parameters [ 'Value5' ] + '" AND ' ; end if ( @parameters [ 'Value6' ] ) query = query + '\'Value6\' = "' + @parameters [ 'Value6' ] + '" AND ' ; end if ( @parameters [ 'Value7' ] ) query = query + '\'Value7\' = "' + @parameters [ 'Value7' ] + '" AND ' ; end if ( @parameters [ 'Value8' ] ) query = query + '\'Value8\' = "' + @parameters [ 'Value8' ] + '" AND ' ; end if ( @parameters [ 'Value9' ] ) query = query + '\'Value9\' = "' + @parameters [ 'Value9' ] + '" AND ' ; end if ( @parameters [ 'Value10' ] ) query = query + '\'Value10\' = "' + @parameters [ 'Value10' ] + '" AND ' ; end if ( @parameters [ 'Value11' ] ) query = query + '\'Value11\' = "' + @parameters [ 'Value11' ] + '" AND ' ; end if ( @parameters [ 'Value12' ] ) query = query + '\'Value12\' = "' + @parameters [ 'Value12' ] + '" AND ' ; end if ( @parameters [ 'Value13' ] ) query = query + '\'Value13\' = "' + @parameters [ 'Value13' ] + '" AND ' ; end if ( @parameters [ 'Value14' ] ) query = query + '\'Value14\' = "' + @parameters [ 'Value14' ] + '" AND ' ; end if ( @parameters [ 'Value15' ] ) query = query + '\'Value15\' = "' + @parameters [ 'Value15' ] + '" AND ' ; end if ( @parameters [ 'Value16' ] ) query = query + '\'Value16\' = "' + @parameters [ 'Value16' ] + '" AND ' ; end if ( @parameters [ 'Value17' ] ) query = query + '\'Value17\' = "' + @parameters [ 'Value17' ] + '" AND ' ; end if ( @parameters [ 'Value18' ] ) query = query + '\'Value18\' = "' + @parameters [ 'Value18' ] + '" AND ' ; end if ( @parameters [ 'Value19' ] ) query = query + '\'Value19\' = "' + @parameters [ 'Value19' ] + '" AND ' ; end if ( @parameters [ 'Value20' ] ) query = query + '\'Value20\' = "' + @parameters [ 'Value20' ] + '" AND ' ; end query = query . chomp ( ' AND ' ) ; query = query + '' raise ( "No Criteria was entered to search on" ) if query == '' puts ( query ) if @debug_logging_enabled entry = @@remedy_forms [ 'CUSTOM:KS_SRV_TableData_base' ] . find_entries ( :all , :conditions => [ query ] , :fields => [ 1 , 179 ] ) raise ( "No matching entry on the CUSTOM:KS_SRV_TableData_base form for the given query [#{query}]" ) if entry . nil? id_list = '<Request_Ids>' id_list2 = '<Instance_Ids>' entry . each do | entry | if ( entry [ 1 ] ) id_list << '<RequestId>' + entry [ 1 ] + '</RequestId>' end if ( entry [ 179 ] ) id_list2 << '<InstanceId>' + entry [ 179 ] + '</InstanceId>' end end id_list << '</Request_Ids>' id_list2 << '</Instance_Ids>' results = <<-RESULTS 
    <results>
		<result name="RequestIdList"> #{ escape ( id_list ) } </result>
		<result name="InstanceIdList"> #{ escape ( id_list2 ) } </result>
    </results>
     RESULTS puts ( results ) if @debug_logging_enabled return results end
Uses the Remedy Login ID to retrieve a single entry from the ITSM v7.x
CTM:People form.
Uses the Remedy Login ID to retrieve a single entry from the ITSM v7 . x CTM : People form .
# Raise error if unable to locate the entry # Retrieve a entries from specified form with given query # Raise error if unable to locate the entry #Begin building XML of fields # Build up a list of all request ids returned #Complete result XML # Build the results to be returned by this handler # Return the results String