REST API call - weird results

Hi,
I am trying to get the number of pull requests that are linked to the Jira ticket from the development section
image

I created the calculated custom field based on the JS script with an additional REST API call

base_url = "/rest/dev-status/1.0/issue/summary?issueId="
r_pullrequest = "";
issue_id = issue.id.toString();
url = base_url + issue_id
while(r_pullrequest==""){	
	r_pullrequest = getDocument(url,{ignoreErrors: [404, 400]});
	k += 1;
}
if(r_pullrequest!=null && r_pullrequest["summary"]!=null
	&& r_pullrequest["summary"]["pullrequest"]!=null
	&& r_pullrequest["summary"]["pullrequest"]["overall"]!=null
	&& r_pullrequest["summary"]["pullrequest"]["overall"]["count"]!=null){
	customfield_pullreq = r_pullrequest["summary"]["pullrequest"]["overall"]["count"]
}

When I test this script here (the script is included in Setting) - I get the right result (i.e. 3 pull requests)


image

but after data import, I got zero (pull requests == 0)
The script has not changed, just included in Settings, but two different results

Please, could you provide any suggestions/pieces of advice?

Thank you ahead
Dima Kostiuk

Hi @DKostiuk,

Suppose you wish to import new data into eazyBI. In that case, you have to define a new JavaScript calculated custom field through the eazyBI advanced settings or as a new calculated field from the import options “Custom fields” tab. Please see more details for both options by clicking on the respective links.

The eazyBI import option “Custom JavaScript code” option is meant to alter already imported information or test the custom JavaScript code results. eazyBI won’t import the custom fields you define there.

If you have added the script into the eazyBI advanced settings or as a new calculated field, please share more details here or at support@eazybi.com.

Best,
Roberts // support@eazybi.com

[jira.customfield_pq2]
name = "Pull Request Version 2.0"
data_type = "integer"
dimension = true
measure = true
javascript_code = '''
var customfield_pq2 = null
base_url = "/rest/dev-status/latest/issue/summary?issueId="
r_pullrequest = "";
issue_id = issue.id.toString();
url = base_url + issue_id
while(r_pullrequest==""){	
	r_pullrequest = getDocument(url,{ignoreErrors: [404, 400]});
}
if(r_pullrequest!=null && r_pullrequest["summary"]!=null
	&& r_pullrequest["summary"]["pullrequest"]!=null
	&& r_pullrequest["summary"]["pullrequest"]["overall"]!=null
	&& r_pullrequest["summary"]["pullrequest"]["overall"]["count"]!=null){
	customfield_pq2 = r_pullrequest["summary"]["pullrequest"]["overall"]["count"]
}
issue.fields.customfield_pq2 = customfield_pq2;
'''

This is a script. I added the script into the eazyBI advanced settings.
The script gives two different results for the same issue
1 - Data import in Issue cube - all results 0 (it is a wrong result)
2 - Jira import options [Additional options] - Custom JavaScript code - if the issue key is input in the field "Test custom JavaScript code with the issue " - we receive the right result for any issue

Hi @DKostiuk,

The JavaScript calculated custom field definition seems correct. I recommend first importing data without the field selected for import and then again with the field selected for import. Check the results.

If you still don’t get the expected results, please check the eazyBI import option custom JavaScript code section again:

  • The custom JavaScript code section should be empty;
  • Check an issue JSON information and see if the field appears in it and its value.

It seems to be a Jira Cloud-related API. If the problem persists, please contact support@eazybi.com with the Atlassian site and eazyBI account details to check the problem in more detail.

Best,
Roberts // support@eazybi.com

How can I do it?

  • Check an issue JSON information and see if the field appears in it and its value.

I tried all possible combinations of import - and the same result

1 - Data import in Issue cube - all results 0 (it is a wrong result)
2 - Jira import options [Additional options] - Custom JavaScript code - if the issue key is input in the field "Test custom JavaScript code with the issue " - we receive the right result for any issue

Hi @DKostiuk,

I am sorry to hear there are still problems. Please share the details below with support@eazybi.com and reference this community post:

  • All content of your eazyBI advanced settings;
  • Jira source application definition - Data from Jira.

Best,
Roberts // support@eazybi.com