handlers/kinetic_helper_record_create_v3/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()
    puts(format_hash("Field Values:", @field_values)) if @debug_logging_enabled
    helper_entry = @@remedy_forms['KS_SRV_Helper'].find_entries(
      :single,
      :conditions => [%|'SurveyInstanceID' = "#{@field_values['SurveyInstanceID']}" AND 'CustomerSurveyInstanceID' = "#{@field_values['CustomerSurveyInstanceID']}" AND 'Status' = "Active"|],
      :fields => []
    )
    if !helper_entry.nil?
      raise(%|An active entry already exists in KS_SRV_Helper for (SurveyInstanceID)="#{@field_values['SurveyInstanceID']} AND (CustomerSurveyInstanceID)="#{@field_values['CustomerSurveyInstanceID']} "|)
    end
    entry = @@remedy_forms['KS_SRV_Helper'].create_entry!(
      :field_values => @field_values,
      :fields       => []
    )
    results = <<-RESULTS
    <results>
      <result name="Entry Id">#{escape(entry.id)}</result>
    </results>
    RESULTS
    puts("Results: \n#{results}") if @debug_logging_enabled
    return results
  end
def execute ( ) puts ( format_hash ( "Field Values:" , @field_values ) ) if @debug_logging_enabled helper_entry = @@remedy_forms [ 'KS_SRV_Helper' ] . find_entries ( :single , :conditions => [ %|'SurveyInstanceID' = "#{@field_values['SurveyInstanceID']}" AND 'CustomerSurveyInstanceID' = "#{@field_values['CustomerSurveyInstanceID']}" AND 'Status' = "Active"| ] , :fields => [ ] ) if ! helper_entry . nil? raise ( %|An active entry already exists in KS_SRV_Helper for (SurveyInstanceID)="#{@field_values['SurveyInstanceID']} AND (CustomerSurveyInstanceID)="#{@field_values['CustomerSurveyInstanceID']} "| ) end entry = @@remedy_forms [ 'KS_SRV_Helper' ] . create_entry! ( :field_values => @field_values , :fields => [ ] ) results = <<-RESULTS 
    <results>
      <result name="Entry Id"> #{ escape ( entry . id ) } </result>
    </results>
     RESULTS puts ( "Results: \n#{results}" ) if @debug_logging_enabled return 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 .
# Check for existing KS_SRV_Helper entry. # Create the KS_SRV_Helper record using the @field_values hash # that was built up.  Pass 'Associations ID' to the fields # argument because these fields will be used in the results xml. # Build the results xml that will be returned by this handler. # Return the results String