How to set dynamic URL path?


For a Connect field plugged on a URL datasource, we can set:

  • URL path which will be appended to the root URL (set in the datasource configuration) to point to a specific endpoint in the API to access.
  • Root element which is the location of the options retrieved by Connect.

The above can be static (fixed) or can be dynamic based on the value of other custom fields, the issue type, the project, etc.

To set a dynamic URL path, we need to set conditions by using the Velocity.

Here's an example:


#if($issue.customfield_XXXXX == "xxx")
	endpoint1/?issue.customfield_XXXXX
#elseif($issue.customfield_XXXXX == "yyy") 
	endpoint2/?issue.customfield_XXXXX
#else
	$query.abort()
#end


In the previous example, based on the value of the custom field customfield_XXXXX, we access different endpoints in the URL path.