Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Web Environment Info to IssueField #71

Open
jrobinsonadrenaline opened this issue Oct 31, 2023 · 1 comment
Open

Adding Web Environment Info to IssueField #71

jrobinsonadrenaline opened this issue Oct 31, 2023 · 1 comment

Comments

@jrobinsonadrenaline
Copy link

Currently my app utilizes the Jira Issue Collector Plugin for users to submit help requests to my SM project, which by default includes an option to include details about the users web environment (Location, Referrer, User-Agent, Screen Resolution). Due to the fact that the plugin hasn't been updated in years we're getting vulnerability warnings from the Rapid7 Scans, so I'm working on creating issues with the REST API. However, I'm having trouble figuring out how to include that Environment data when creating a new issue. I see the local $environment property in the IssueField class, but not seeing any set methods, and even though that field takes a paragraph element, the property is marked as array type in that class. Is this something that is possible with this library, or will I need to manually manipulate the JSON object before passing to the IssueService Create method?

  1. The API Documentation Indicates that it accepts that variable in the formData (which I am passing from my custom form)
  2. The only place I can see reference to the environment key is in the IssueField Class

Here is the method that I'm using to generate the Issue.

`$det = new AtlassianDocumentFormat(
(new Document())
->paragraph()
->text($formData['description'])
->end()
);

    $issue = (new IssueField())
        ->setProjectKey('DTSM')
        ->setSummary($formData['summary'])
        ->setReporterName($formData['name'])
        ->addLabelAsString($_ENV['JIRA_ISSUE_LABEL'])
        ->setIssueTypeAsString($_ENV['JIRA_ISSUE_TYPE'])
        ->addCustomField('customfield_10101', $formData['email'])
        ->setDescription($det);

    (new IssueService())->create($issue);`

Library version: "lesstif/jira-cloud-restapi": v1.6.2

Any assistance is greatly appreciated!

@lesstif
Copy link
Owner

lesstif commented Nov 20, 2023

Hi @jrobinsonadrenaline I hope you're doing well. sorry to late reply.
I believe that If you have decided to gather user web environment through REST API, adding custom fields is a suitable solution for you.
for instance, you can add custom fields for each field (Location, Referrer, User-Agent, Screen Resolution).

$issueField->setProjectKey('DTSM')
                ->setSummary('something\'s wrong')
                 ->setSummary($formData['summary'])
                ->setReporterName($formData['name'])
                ->addCustomField('customfield_10100', 'user env field') // 
                ->addCustomField('customfield_10200', 'Referrer') // Select List (single choice)
                ->addCustomField('customfield_10408', [
                    ['value' => '1024 × 768'], ['value' => '1920 × 1080']
                ]) // Select List (Screen Resolution)
    ;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants