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

How can i parse SocOptionImpl custom field? #598

Open
ItamarShDev opened this issue Dec 7, 2022 · 3 comments
Open

How can i parse SocOptionImpl custom field? #598

ItamarShDev opened this issue Dec 7, 2022 · 3 comments

Comments

@ItamarShDev
Copy link

When i call the ticket i get SocOptionImpl{label='some-label', value='some-value'}

How can i parse it?

@andygrunwald
Copy link
Owner

@ItamarShDev Can you provide a full but minimal code example?

And please provide basic information like

  • go-jira version (git tag or sha):
  • Go version (go version):
  • Jira type (cloud or on-premise):
  • Jira version / Api version:

Thank you

@andygrunwald
Copy link
Owner

@ItamarShDev Did you find a solution for your problem?
I think this would help others in the community as well.

@andygrunwald andygrunwald reopened this Mar 3, 2023
@ItamarShDev
Copy link
Author

@andygrunwald Thank you for making sure i will write my solution. I have meant to write a comment but forgot!

What i did (and it might be a bad solution) is this:

func (s *service) getFieldSocOptionImplValue(ticketFields *jira.IssueFields, fieldID string) string {
	var fieldValue string
	field, exist := ticketFields.Unknowns.Value(fieldID)
	if exist {
		fieldMap, ok := field.([]interface{})
		if ok {
			re := regexp.MustCompile(`value='(.*)'`)
			for _, v := range fieldMap {
				matches := re.FindStringSubmatch(v.(string))
				fieldValue = matches[1]
			}
		}
	}
	return fieldValue
}

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