How to configure parent - child relationships in nFeed using JSON data

Richard Lucas May 11, 2015

Hi,

I'm a bit puzzled with the nFeed configuration need to configure a Parent - Children fields that use the nFeed plugin.

We have a URL that returns data that looks like this sample

[
{"program":"My First Program","project":"My First Project Development","tesCode":"IBS-PRX-1234"},
{"program":"My First Program","project":"My First Project Test","tesCode":"IBS-PRT-2345"},
{"program":"My First Program","project":"My First Project Rollout","tesCode":"IBS-PRX-3456"},

[{"program":"My Second Program","project":"My Second Project Development","tesCode":"IBS-ABC-1234"},
{"program":"My Second Program","project":"My Second Project Test","tesCode":"IBS-ABC-2345"},
{"program":"My Second Program","project":"My Second Project Rollout","tesCode":"IBS-ABC-3456"}
]

I want to be able to select the Program in one select list, which then controls the population of the Project select list and TES code read-only fields.

Ie - I set the Program field to be 'My First Program'  and the Project field is then populated with

My First Project Development, My First Project Test, My First Project Rollout

Then when I select a Project from list, the TES code is populated with the correct TES code value.

Any hints would be gratefully recieved.

Kind regards,

 

Richard

1 answer

0 votes
Cyrille Martin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 11, 2015

Hi Richard,

to implement your use case, you will need to have 2 different JSON URL.

The first JSON call will return you the program list (you can use the URL with the returns value you put in your question)

The second JSON call will need to return the list of project for a specific program, and to do that you need to have specific URL for which you will combine URL and the program value.

This means you cannot re-use the same the URL than the one used for the program list and make a filter with a JSONPath because for the moment no context value can be injected in the JSONPath. (You can create an improvement on our JIRA, prior to that you will need to create an account.)

Cyrille

 

 

 

 

Richard Lucas May 11, 2015

Hi Cyrille, Thanks for the reply - would you be able to give example configurations, or psuedo configurations. Kind regards,

James Kosiba June 30, 2015

Hello Richard: It looks like it has been a while since you originally posted this, but in case you are still having issues with this process, or if anyone else finds this thread while researching the same issue, here is a potential solution. The following steps assume that you have already set up your custom fields in JIRA (Administration > Issues > Custom Fields) (JIRA 6.3+). Please note: The functionality of this process is largely dependent upon how your JSON is configured for queries. Also note, anything that is added to the ‘Query’ field under the Field Input tab of your nFeed Configurations will append to your Datasources Connector URL. Example: If you have your URL to your JSON as http://URL/Search/Id and enter a Query of $issue.customfield_12345, it will result in nFeed trying to collect from the path http://URL/Search/Id/$issue.customfield_12345. In this example you would need to make sure that your JSON would respond to the query format http://URL/Search/Id/{id}. You will first set up your ‘parent’ field as a regular JSON query that should return a list of all ‘programs’. 1. Set up your ‘Datasources Connector’ URL for JSON Content Type. 2. Create a ‘Configuration’ for the parent field to return your program list (Display Mode: Select list | Value Selection: Single | JSON Path: $.program[*] | JSON Columns: program). Once you have your parent field returning a list you will set your first ‘child’ field to populate based on the parent selection. To do so, you will need to add the parent field ID to the child field’s ‘Query’ window. As indicated previously, this will append the id to your web query so you will need to confirm that your JSON will respond appropriately. 1. Create a ‘Confirguration’ for the child field (Display Mode: Select list | Value Selection: Single | Query: $issue.customfield_##### | JSON Path: $.program[*].project | JSON Columns: project). Once this is set up, you will see an entry under ‘Parent Dependencies’ on your Configurations tab in nFeed. Again, in this example you would need to make sure that your JSON would correctly process the address ‘http://YourURL/PathToJSON/program’. So, for the sake of being explicit, ‘http://YourURL/PathToJSON/My First Program’. Please also note, you may experience issues with this address if you do have spaces in your program names (as it is not correctly encoded for URL (%20 for spaces I believe). You would then duplicate the previous step for your final field inserting the first child’s id ($issue.customfield_#####) in the Query box and altering the JSON Path as needed to drill down to your TES Codes. Possibly $.program.project[*].tesCode. I have never drilled down to a secondary child so this is untested by me and I am making some assumptions, so you may need to play around with the path some. This secondary child would also be configured as ‘Display Mode: Read-only | Value Selection: Single’. Hope this helps you or anyone else that may be in a similar situation. James

Suggest an answer

Log in or Sign up to answer