Here is my issue. I have set up automation that calls an API. This is how the body looks like
{ "firstName": "{{issue.customfield_10284}}", "lastName": "{{issue.customfield_10285}}", "displayName": "{{issue.customfield_10284}}", "name": "{{issue.customfield_10284}}", "oib": "{{issue.customfield_10265}}", "defaultAccount": { "accountCode": "{{issue.customfield_10247}}" }, "userTid": { "name": "{{issue.customfield_10274}}", "feeFixed": "{{issue.customfield_10278}}", "feePercentage": "{{issue.customfield_10279}}", "buyConfirmation": "{{issue.customfield_10369}}", "multipleScan": "{{issue.customfield_10372}}", "providerId": "{{issue.customfield_10260}}", "isKeksMerchant": true, "eventCategory": { "eventCategoryId": "{{issue.customfield_10280}}" } }, "skipPaymentInfo": true }
The problem lies with providerId. Currently, 10260 is a multi select option, with each option consisting of key-value pairs, like "14 - String".
What I need is just the numeric value. What I've tried to do was setting up a temporary trimmed value 10374, which is a free text format.
First, I have tried trimming 10260 to 10374 with different functions
{ "fields": { "customfield_10374": "{{issue.customfield_10260.match("^\\d+")}}" } }
{ "fields": { "customfield_10374": "{{issue.customfield_10260.substringBefore(' - ')}}" } }
{ "fields": { "customfield_10374": "{{issue.customfield_10260.split(' - ').first}}" } }
After that I tried replacing the
"providerId": "{{issue.customfield_10260}}
with
"providerId": "{{issue.customfield_10374}}"
in the API. I would just be getting response errors because it turns out that my temporary value was not being saved.
As a control, I have set up comments in Jira issues:
Trimmed value is: {{issue.customfield_10374}}
Full value for (customfield_10260) is: {{issue.customfield_10260}}
The first one returns null, the second one returns "14 - String". In happy path, I would get "14" for the first command.
Not sure why the value is not being saved and even if this approach is doable.
I have also tried to trim the value directly in APi body with different commands, but In this case I am just getting errors
{ "firstName": "{{issue.customfield_10284}}", "lastName": "{{issue.customfield_10285}}", "displayName": "{{issue.customfield_10284}}", "name": "{{issue.customfield_10284}}", "oib": "{{issue.customfield_10265}}", "defaultAccount": { "accountCode": "{{issue.customfield_10247}}" }, "userTid": { "name": "{{issue.customfield_10274}}", "feeFixed": "{{issue.customfield_10278}}", "feePercentage": "{{issue.customfield_10279}}", "buyConfirmation": "{{issue.customfield_10369}}", "multipleScan": "{{issue.customfield_10372}}", "providerId": "{{issue.customfield_10260.match('^\\d+')}}", "isKeksMerchant": true, "eventCategory": { "eventCategoryId": "{{issue.customfield_10280}}" } }, "skipPaymentInfo": false }
Any tips are appreciated.