pycontribs / jira

Python Jira library. Development chat available on https://matrix.to/#/#pycontribs:matrix.org
https://jira.readthedocs.io
BSD 2-Clause "Simplified" License
1.96k stars 873 forks source link

Get form data of Jira Issues #1647

Open damnmso opened 1 year ago

damnmso commented 1 year ago

Problem trying to solve

I'd like to automate some processes. We use right now Jira and tickets are created by users which are then done manually, containing important information in forms. Without access to those fields, its impossible to automate anything.

Possible solution(s)

Provide some way to access those fields via the jira object

Alternatives

No response

Additional Context

We use the on-premise solution of jira if thats an important information here also created https://community.atlassian.com/t5/Jira-Software-questions/accessing-form-data-proforma-with-the-official-jira-python/qaq-p/2335957, as i am not sure if this is a jira/proforma thing or only a missing feature in this python client

damnmso commented 1 year ago

i added

   def get_form(self, issue: str, formid: str) -> list[dict]:
        """For the specified issue, returns the form data as key/value list. (Admin required).

            Args:
                issue (str): The issue id.
                formid (str): the ID of the form, default is 1

            Returns:
                List[dict]: A dictionary containing the "answers" as value and the label as key.
        """
        response = self._session.get(self.server_url + "/rest/proforma/1/issue/" + issue + "/form/" + formid + "/answers")
        return json_loads(response)

created https://github.com/pycontribs/jira/pull/1648