Applink issue with url
Asked by HR:

I would like to achieve to get a list of keys (linked to Epic) by typing only the issue number (Epic in JIRA)

```
jql="issueFunction in issuesInEpics('key=[entry.jiraTicket]')"
```

This works fine. I have all the following code

```
<p class="auto-cursor-target">
<br/>
</p>
<ac:structured-macro ac:macro-id="5e3d56b1-d746-459b-8e10-bd1dbfa8e0bd" ac:name="confiform" ac:schema-version="1">
<ac:parameter ac:name="formName">search</ac:parameter>
<ac:rich-text-body>
<p class="auto-cursor-target">
<br/>
</p>
<ac:structured-macro ac:macro-id="a66a98af-909b-43c7-8293-fdfeede5d88e" ac:name="confiform-entry-register" ac:schema-version="1">
<ac:parameter ac:name="embedded">true</ac:parameter>
<ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p class="auto-cursor-target">
<ac:structured-macro ac:macro-id="7438217c-1e53-4381-8cab-9518213c9d1b" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">jiraTicket</ac:parameter>
<ac:parameter ac:name="fieldLabel">JIRA Ticket #</ac:parameter>
<ac:parameter ac:name="extras">Jira</ac:parameter>
<ac:parameter ac:name="type">jira</ac:parameter>
</ac:structured-macro>
</p>
<p class="auto-cursor-target">
<ac:structured-macro ac:macro-id="934833ec-5607-466b-aafc-1778837cb19e" ac:name="confiform-field-definition-rules" ac:schema-version="1">
<ac:parameter ac:name="condition">!jiraTicket:[empty]</ac:parameter>
<ac:parameter ac:name="values">jql="issueFunction in issuesInEpics('key=[entry.jiraTicket]')"</ac:parameter>
<ac:parameter ac:name="action">Set expression</ac:parameter>
<ac:parameter ac:name="actionFieldName">jiraTicket, jql</ac:parameter>
</ac:structured-macro>
</p>
<p class="auto-cursor-target">
<ac:structured-macro ac:macro-id="66a73e10-6d54-4497-9bc9-10a0822db379" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">jql</ac:parameter>
<ac:parameter ac:name="fieldLabel">JQL</ac:parameter>
<ac:parameter ac:name="extras">Jira</ac:parameter>
<ac:parameter ac:name="type">text</ac:parameter>
<ac:parameter ac:name="required">true</ac:parameter>
</ac:structured-macro>
</p>
<p class="auto-cursor-target">
<ac:structured-macro ac:macro-id="3d659847-642b-4f3c-a14f-13ce301311c7" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">result</ac:parameter>
<ac:parameter ac:name="fieldLabel">Result</ac:parameter>
<ac:parameter ac:name="type">hidden</ac:parameter>
</ac:structured-macro>
</p>
<p class="auto-cursor-target">
<ac:structured-macro ac:macro-id="4b01cd54-f109-44aa-8a36-ec96ef5a61dc" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">total</ac:parameter>
<ac:parameter ac:name="fieldLabel">Total</ac:parameter>
<ac:parameter ac:name="type">number</ac:parameter>
</ac:structured-macro>
</p>
<p class="auto-cursor-target">
<ac:structured-macro ac:macro-id="2bef040d-1ead-4f01-8b41-82f17a183320" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">issue</ac:parameter>
<ac:parameter ac:name="fieldLabel">Jira Issues</ac:parameter>
<ac:parameter ac:name="extras">Jira</ac:parameter>
<ac:parameter ac:name="type">jira</ac:parameter>
</ac:structured-macro>
</p>
<ac:structured-macro ac:macro-id="6c27b375-08d7-4a4f-8082-3466f7747f33" ac:name="confiform-ifttt" ac:schema-version="1">
<ac:parameter ac:name="action">AppLink service</ac:parameter>
<ac:parameter ac:name="event">onCreated</ac:parameter>
<ac:parameter ac:name="extras2">/rest/api/latest/search?jql=[entry.jql]&amp;fields=key</ac:parameter>
<ac:parameter ac:name="resultName">myjqlsearchresult</ac:parameter>
<ac:parameter ac:name="who">GET</ac:parameter>
<ac:rich-text-body>
<p class="auto-cursor-target">
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p>
<br/>
</p>
<ac:structured-macro ac:macro-id="b6c6559f-4f29-4db5-9305-10586b07b63c" ac:name="confiform-ifttt" ac:schema-version="1">
<ac:parameter ac:name="action">Create ConfiForms Entry</ac:parameter>
<ac:parameter ac:name="event">onCreated</ac:parameter>
<ac:parameter ac:name="title">entryId=[entry.id]&amp;result=${iftttResult_myjqlsearchresult}</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p class="auto-cursor-target">
<br/>
</p>
<ac:structured-macro ac:macro-id="ab0885f8-cec6-467d-900c-d97a90f033cd" ac:name="confiform-ifttt" ac:schema-version="1">
<ac:parameter ac:name="action">Create ConfiForms Entry</ac:parameter>
<ac:parameter ac:name="event">onCreated</ac:parameter>
<ac:parameter ac:name="title">entryId=[entry.id]&amp;total=[entry.result.asJSON.total]</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p class="auto-cursor-target">
<br/>
</p>
<ac:structured-macro ac:macro-id="373574ef-27ce-45b3-9b2c-d0bb3449ced2" ac:name="confiform-ifttt" ac:schema-version="1">
<ac:parameter ac:name="action">Create ConfiForms Entry</ac:parameter>
<ac:parameter ac:name="event">onCreated</ac:parameter>
<ac:parameter ac:name="title">entryId=[entry.id]&amp;issue=[entry.result.asJSON.issues[0].key]</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p class="auto-cursor-target">
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p class="auto-cursor-target">
<br/>
</p>
```

When I select the Epic this will create the JQL script however URL for the JQL script has an error and I didn't find the place where to change it.

Here is the error log:

* java.lang.IllegalArgumentException: java.net.URISyntaxException: Illegal character in query at index 90: <https://issues.merck.com/https://issues.merck.com/rest/api/latest/search?jql=issueFunction> in issuesInEpics('key=TEST-147')\&fields=key

If I copy the URL and correct and add this URL to the browser I will receive correct answer:

```
https://issues.merck.com/rest/api/latest/search?jql=issueFunction in issuesInEpics('key=TEST-147')&fields=key
```

Here is the response from the corrected URL:

```
{"expand":"schema,names","startAt":0,"maxResults":50,"total":10,"issues":[{"expand":"operations,versionedRepresentations,editmeta,changelog,renderedFields","id":"3537466","self":"https://issues.merck.com/rest/api/latest/issue/3537466","key":"TEST-225"},{"expand":"operations,versionedRepresentations,editmeta,changelog,renderedFields","id":"3338365","self":"https://issues.merck.com/rest/api/latest/issue/3338365","key":"TEST-157"},{"expand":"operations,versionedRepresentations,editmeta,changelog,renderedFields","id":"3338364","self":"https://issues.merck.com/rest/api/latest/issue/3338364","key":"TEST-155"},{"expand":"operations,versionedRepresentations,editmeta,changelog,renderedFields","id":"3338363","self":"https://issues.merck.com/rest/api/latest/issue/3338363","key":"TEST-154"},{"expand":"operations,versionedRepresentations,editmeta,changelog,renderedFields","id":"3338362","self":"https://issues.merck.com/rest/api/latest/issue/3338362","key":"TEST-153"},{"expand":"operations,versionedRepresentations,editmeta,changelog,renderedFields","id":"3338406","self":"https://issues.merck.com/rest/api/latest/issue/3338406","key":"TEST-152"},{"expand":"operations,versionedRepresentations,editmeta,changelog,renderedFields","id":"3338360","self":"https://issues.merck.com/rest/api/latest/issue/3338360","key":"TEST-151"},{"expand":"operations,versionedRepresentations,editmeta,changelog,renderedFields","id":"3338405","self":"https://issues.merck.com/rest/api/latest/issue/3338405","key":"TEST-150"},{"expand":"operations,versionedRepresentations,editmeta,changelog,renderedFields","id":"3338359","self":"https://issues.merck.com/rest/api/latest/issue/3338359","key":"TEST-149"},{"expand":"operations,versionedRepresentations,editmeta,changelog,renderedFields","id":"3338358","self":"https://issues.merck.com/rest/api/latest/issue/3338358","key":"TEST-148"}]}
```

I need to find a place where to fix duplicated beginning of the URL

*<https://issues.merck.com/https://issues.merck.com/>*


Answers:
author: JiraAdmin
body: I had the same problem. If I remember correctly, you need to encode the JQL search string.  

Assume that your field is named 'JQLSearchString'.

The value in JQLSearchString would be issueFunction in issuesInEpics('key=\[entry.jiraTicket\]')

The service url would be:

++[/rest/api/latest/search?jql=](https://issues.merck.com/https://issues.merck.com/rest/api/latest/search?jql=issueFunction)**\[entry.JQLSearchString.urlencode\]**++


Tags: confiforms

confluence-server

jira

server