jira-tools icon indicating copy to clipboard operation
jira-tools copied to clipboard

How to extract parent_id field?

Open sciancio opened this issue 5 years ago • 12 comments

Is it possible to extract parent_id field? I view this field ("parent link") disabled among "Configure custom fields".

Thanks.

sciancio avatar May 29 '19 10:05 sciancio

Where would you need to use it? In custom functions (here you can use the actual Jira field id) or in the "List issues from filter" via the dialog?

I could certainly look into that one, if im able to implement support for that field (wont be able to do so before June 10 - due to vacation)

ljay79 avatar May 29 '19 12:05 ljay79

I create a table via "List issue from filter". I'd like a column with the parent id link of subtask. If it is possible to extract it in any other way, suggestions are welcome. Thanks for this work.

sciancio avatar May 29 '19 12:05 sciancio

With the custom function JST_search() it would be possible. With the dialog "list issues from filter" not yet.

ljay79 avatar May 29 '19 13:05 ljay79

It would be nice to have parent id extracted via "List issue from filter". It would be even better if the order of the rows extracted could be customized to highlight the connection between task (parent) / subtask. For example: Row 1: task 1, n/a Row 2: subtask 1, task 1, ... Row 3: subtask 2, task 1, ... Row 4: subtask 3, task 1, ... Row 5: task 2, n/a Row 6: subtask 4, task 2, ... Row 7: subtask 5, task 2, ... ...

sciancio avatar Jun 11 '19 10:06 sciancio

I researched a little deep. Apparently "Parent Link" is a licensed field from Jira Portfolio. I do not have that feature and are unable to get details on the JSON representations for the fields value.

Could you activate the add-ons debugging in the "About" dialog, provide me the "Temp. User Key" and perform following actions while debugging is "On".

  • open menu -> "Jira field map"
  • locate the ID of your field "Parent Link"; looks like "customfield_12345"
  • then perform a small search in any cell ie: JST_search("status = Done"; "key,customfield_12345"; 5)
    • using the retrieved field ID instead of the sample "customfield_12345"

This should provide me with enough JSON debug info in my logs to dive depper.

ljay79 avatar Jun 14 '19 11:06 ljay79

BTW: The customization and sorting of the resulting list as suggested i wont be able to implement. In best case, i will be able to add support for the "Parent Link" field so i would show up in all retrieved IssueTables.

ljay79 avatar Jun 14 '19 11:06 ljay79

Done. The temporary user key is AANBUuWRvQvd32enqPKLqSQfEQSqDKVJNOj69374OMJ2IQo6s1v1uY+DVjNw4hhd74x2yvH1ZigQ

Thanks.

sciancio avatar Jun 14 '19 12:06 sciancio

Hi @sciancio

thanks for the info. I had a look at the JSON responses from your JIRA queries. Your requests do actually return the same values as on my instance. Its does not return actual values for that field as it isnt licensed apparently.

Actual sample response from your query:

{
	"expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields",
	"id": "34753",
	"self": "https://XXXX.atlassian.net/rest/api/2/issue/34753",
	"key": "VSHO-81",
	"fields": {
		"customfield_10511": {
			"hasEpicLinkFieldDependency": false,
			"showField": false,
			"nonEditableReason": {
				"reason": "PLUGIN_LICENSE_ERROR",
				"message": "Portfolio for Jira must be licensed for the Parent Link to be available."
			}
		}
	}
}

Im not familiar with that Jira add-on "Portfolio" but i wonder how you can use it within Jira itself if it isnt apparently activated/available due to licensing?

ljay79 avatar Jun 14 '19 13:06 ljay79

Oh, maybe it depends on the issue you query for. Can you do the same procedure again but this time, query a specific Jira issue where you know for sure, it has a value for the "Parent Link" field.

ie: JST_search("key = VSHO-XX"; "key,customfield_10511"; 1) Replace VSHO-XX with an existing issue key id from your Jira, where you can confirm it has a value for "Parent Link".

ljay79 avatar Jun 14 '19 13:06 ljay79

Done. Same key.

sciancio avatar Jun 14 '19 13:06 sciancio

Sorry to say, but same problem on Jira side:

{
		"expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields",
		"id": "38346",
		"self": "https://XXXXX.atlassian.net/rest/api/2/issue/38346",
		"key": "ROS-73",
		"fields": {
			"customfield_10511": {
				"hasEpicLinkFieldDependency": false,
				"showField": false,
				"nonEditableReason": {
					"reason": "PLUGIN_LICENSE_ERROR",
					"message": "Portfolio for Jira must be licensed for the Parent Link to be available."
				}
			}
		}
	}

At this point, im not sure how i would be able to have the google add-on able to retrieve the requested info from "Parent Link".

ljay79 avatar Jun 14 '19 13:06 ljay79

Hi @sciancio

thanks for the info. I had a look at the JSON responses from your JIRA queries. Your requests do actually return the same values as on my instance. Its does not return actual values for that field as it isnt licensed apparently.

Actual sample response from your query:

{
	"expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields",
	"id": "34753",
	"self": "https://XXXX.atlassian.net/rest/api/2/issue/34753",
	"key": "VSHO-81",
	"fields": {
		"customfield_10511": {
			"hasEpicLinkFieldDependency": false,
			"showField": false,
			"nonEditableReason": {
				"reason": "PLUGIN_LICENSE_ERROR",
				"message": "Portfolio for Jira must be licensed for the Parent Link to be available."
			}
		}
	}
}

Im not familiar with that Jira add-on "Portfolio" but i wonder how you can use it within Jira itself if it isnt apparently activated/available due to licensing?

Yes this is problem if Jira side. But you can solve another way by below code.

dynamic jsonObj = JsonConvert.DeserializeObject(json); JObject jsonObject = jsonObj?.issue as JObject; string parentkey =Convert.ToString(jsonObject["fields"]?["customfield_10018"]?["data"]?["key"]);

VinodParmar avatar Dec 29 '20 09:12 VinodParmar