princenyeche/jiraone

field_name: Target a field name to render. datatype -> string

manojs888 opened this issue · 4 comments

Dear Reader,
Are you able to provide an example for the use of field_name please.
I have assigned field_name=”Summary” but every time I assign this variable a value and run the script then I get nothing in the CSV.
If I exclude the field_name then all is as expected. PROJECT.change_log(jql=jql, folder=folder, file=file, show_output=show_output, field_name=field_name) is what I am using.
I have tried using caps and all lowercase and tried also issue.summary, have tried other field names too. I am at a lost, thank you

The field_name argument targets a specific field that you want to be included in the export only. It is a sort of filtering of the export data. The first thing you need to know is that it takes the data from the change history, so if the summary changes are not in the history then you won't see any data. The naming conversion should follow how the field is named on your Jira UI.

from jiraone import LOGIN, PROJECT

user = "emailaddress"
password = "token"
link = "https://yourinstance.atlassian.net"
LOGIN(user=user, password=password, url=link)

if __name__ == '__main__':
    # the output of the file would be absolute to the directory where this python file is being executed from
    jql = "project in (PYT) ORDER BY Rank DESC"  # A valid JQL query
    field = "Summary"
    PROJECT.change_log(jql=jql, field_name=field)

Yes, that's the whole logic. The field_name in itself adds filtering to the data if not, all the data history is exported. So if you want a historical data field to appear only in the export then use the field_name argument. If not, don't use it. Your example of use cases 1 and 2 is exactly how it works.