Skip to main content
Kinetic Community

Bridged Resources

This article describes how to leverage bridged resources (Kinetic Request 5.1.0) in your service items.

The bridged_resource function can be used to create bridged resources for set fields external, populate menu, and custom action events.

The bridged_dynamic_list function can be used to create bridged resources for dynamic list questions.

The bridged_dynamic_default function can be used to create bridged resources for dynamic default answers.

Arguments

The first and only string argument is the model name to be used.

The :qualification option configures which qualification of the model to use.  All bridged resources will require the qualification option to be configured.  Some bridged resources will require qualifications to return specifically single or multiple results, see below for details.

The :label_attribute option configures the attribute of the model to be used as a label.  Some bridged resources will require this option to be configured, see below for details.

The :value_attribute option configures the attribute of the model to be used as a value.  Some bridged resources will require this option to be configured, see below for details.

Bridged Resource Parameters

Depending on the qualification being used for the bridged resource, one or more bridged resource parameters may be required.  These can be configured by using the parameter function within the do-end block of the bridged resource function call.

The parameter function takes two string arguments: the Parameter Name and the Parameter Value.  See below for examples.

Creating Bridged Resources

Dynamic List

question "Dynamic List", "Dynamic List", :dynamic_list do
  bridged_dynamic_list "Employee",
    :qualification   => "All",
    :label_attribute => "Full Name",
    :value_attribute => "Email"
end
 
A dynamic list question can be configured to use a bridged resource simply by calling the bridged_dynamic_list function within the do-end block of the question call.
 
In this instance the bridged resource is required to have a qualification that returns multiple results and it is required that both label and value attributes are configured.

Dynamic Default

question "Dynamic Default", "Dynamic Default", :free_text, :advance_default do
  bridged_dynamic_default "Employee",
    :qualification   => "By Login",
    :value_attribute => "First Name" do 
    parameter "Login", "<%=application[\"username\"]%>"
  end
end

A dynamic default can be configured to use a bridged resource by calling the bridged_dynamic_default function within the do-end block of the question call.  Also note that it is required that the :advance_default option is specified for the question.

In this instance the bridged resource is required to have a qualification that returns a single result and it is required that value attribute is configured.

Also note that the qualification used in this example requires a parameter.  The parameter is configured by calling the parameter function within the bridged_dynamic_default call.

Set Fields External Event

      event "Set Fields External", :click, :set_fields_external, :use_bridging do
        bridged_resource "Employee",
          :qualification => "All"
        field_map "Set Fields Target", "<%=attribute[\"Full Name\"]%> "
      end

A set fields external event can be configured to use a bridged resource by using the :use_bridging option and calling the bridged_resource function within the do-end block of the event call.

In this instance there are no requirements regarding the type of qualification and neither the label nor value attributes are required.

Populate Menu Event

      event "Populate Menu", :click, :populate_menu, :use_bridging do
        bridged_resource "Employee",
          :qualification   => "All",
          :label_attribute => "Full Name",
          :value_attribute => "Email"
        target "Populate Menu Target"
      end

A populate menu event can be configured to use a bridged resource by using the :use_bridging option and calling the bridged_resource function within the do-end block of the event call.

In this instance the bridged resource is required to have a qualification that returns multiple results and it is required that both label and value attributes are configured.

Custom Action Event

      event "Custom Event", :click, :custom_action, :use_bridging do
        bridged_resource "Employee",
          :qualification => "All"
        custom_code "//...code goes here..."
      end

 

A custom action event can be configured to use a bridged resource by using the :use_bridging option and calling the bridged_resource function within the do-end block of the event call.

In this instance there are no requirements regarding the type of qualification and neither the label nor value attributes are required.

Sample

This file contains KURL code for a working service item that contains each of the bridged resources described above:  Bridged Resource Demo.rb