guilhemmarchand / TA-jira-service-desk-simple-addon

Atlasian JIRA add-on for Splunk alert actions
11 stars 8 forks source link

Cascading select field fails to be parsed as a custom field entry #128

Closed uxhal closed 2 years ago

uxhal commented 2 years ago

Hello @guilhemmarchand,

Consider following entry as a custom field:

"customfield_10110": {"value": "samplevalue",
"child": {"value": "samplecascadingvalue"} }

We are using such data to populate a Jira ticket with a cascading select field value. It seems to be correct according to the documentation at https://developer.atlassian.com/server/jira/platform/jira-rest-api-examples/

It does not get accepted by the alert action though. I have checked the add-on logs and using such structure returns "json loads failed to accept some of the characters". The data before the json.loads looks like that for the mentioned part:

"customfield_10110": {"value": "samplevalue",
\"child\": {"value": "samplecascadingvalue"} }

I can only assume it is due to not having "child" key name parsed as part of the https://github.com/guilhemmarchand/TA-jira-service-desk-simple-addon/blob/master/package/bin/ta_service_desk_simple_addon/modalert_jira_service_desk_helper.py#L112 function, yet I may be wrong about it. Let me know what do you think.

guilhemmarchand commented 2 years ago

Hi @uxhal

I see, in the alert action configuration, there is an additional setting for custom fields which is called custom fields parsing:

https://ta-jira-service-desk-simple-addon.readthedocs.io/en/latest/userguide.html#jira-custom-fields

By default, it is enabled, what it does is checking the content to escpace any problematic character that would lead to break the JSON structure, in your case it is counter productive as it didn't expect a sub-json structure.

Can you try to disable it on your alert with the custom field, then get the alert to trigger and check the result.

Let me know.

Guilhem

uxhal commented 2 years ago

That was it, disabling parsing has fixed my problem. Thank you!

guilhemmarchand commented 2 years ago

Awesome @uxhal You are very welcome