Sometimes, JIRA list box data pills come up looking strange. Here's an example:
{"self"=>"https://jira.xyz.com/rest/api/2/customFieldOption/123", "value"=>"Acceptable", "id"=>"123”}
What is it, and how do we fix it?
Firstly, this means that your Workato recipe is getting a JIRA value from a list box like this:
OPTIONS: Acceptable Unacceptable
JIRA stores the option, "Acceptable", as a data point with a unique ID of "123", and a value of "Acceptable".
{"self"=>"https://jira.xyz.com/rest/api/2/customFieldOption/123", "value"=>"Acceptable", "id"=>"123”}
In order for Workato to choose the right option, the recipe needs to know the "value". To extract "Acceptable" out of this example, we can use formula mode. Here's one way that it could be accomplished (replaced OPTIONS with the Workato data pill):
OPTIONS.to_s.split("value=\"")[1].split("\"")[0]
If you run the recipe now, you will get "Acceptable". Great!
However, one more step is required for Workato to choose the right dropdown option. For instance, Workato may understand the list's values like this:
option_accept: "Acceptable", option_refuse: "Unacceptable"
In this example, we would still need to fill in "option_accept" in order for Workato to choose "Acceptable". To find out what each value is mapped to, click the blue button on the right of the list field to switch between the list value and custom value.
To do so, we can map values like this:
{"Acceptable" => "option_accept", "Unacceptable" => "option_reject"}[OPTIONS.to_s.split("value=\"")[1].split("\"")[0]]
Now, when we run our Workato recipe, the JIRA field will be properly mapped.