Can custom fields of type WebLink be queried?

Document ID : KB000057576
Last Modified Date : 14/02/2018
Show Technical Document Details

Issue

A user needs to query another system's defect ID in a CA Agile Central WebLink custom field but it is not working.

Cause

WebLink type custom fields is not queriable. This is the reason that all CA Agile Central connectors use String type of custom field and not WebLink type to reference an artifact in another system.

Below is a screenshot from WS API object model. It notes that "This attribute cannot be used in queries"

User-added image

Since it is not possible to query by WebLink any programmatic solution would involve querying artifacts by some other criteria, and later filtering the results as shown in this Ruby example based on CA Agile Central API Toolkit for Ruby.
?
require 'rally_api'

headers = RallyAPI::CustomHttpHeader.new()
headers.name = "Create stories and tasks"
headers.vendor = "Nick M RallyLab"
headers.version = "1.0"

config = {:base_url => "https://rally1.rallydev.com/slm"}
config[:api_key] = "_abc123"  
config[:workspace] = "W1" 
config[:project] = "Team1"
config[:headers] = headers 
config[:version] = "v2.0"

@rally = RallyAPI::RallyRestJson.new(config)


workspace = "https://rally1.rallydev.com/slm/webservice/v2.0/workspace/123"
project = "https://rally1.rallydev.com/slm/webservice/v2.0/project/456"

query = RallyAPI::RallyQuery.new()
query.type = "defect"
query.fetch = "Name,FormattedID,c_MyWebLink"
query.workspace = {"_ref" => workspace }
query.project = {"_ref" => project }
query.query_string = "(Tags.Name = \"tag1\")"
query.limit = 2 

results = @rally.find(query)

defects_with_empty_link = []
defects_with_link = []

results.each do |defect|
  puts defect.Name 
  defect.read    
  if defect.c_MyWebLink.LinkID.nil?
    defects_with_empty_link << defect
  else
    defects_with_link << defect
  end
end

puts "----------EMPTY WEB LINK----------"
defects_with_empty_link.each do |defect|
  puts "#{defect.FormattedID}, WebLink: #{defect.c_MyWebLink.LinkID}"
end

puts "---------WEB LINK-----------------"
defects_with_link.each do |defect|
  puts "#{defect.FormattedID}, WebLink: #{defect.c_MyWebLink.LinkID}"
end

NOTE: the code example is available as is. It is not supported by CA Agile Central.