Hi
Learning as I go here - I've set up a flow that raises a Jira when certain responses are received through an MS Form. Everything is working on that front, and I'm now looking to automatically add the priority to the Jira ticket based on the priority given in the form response. As the values in the form and Jira are different, I thought I could use an if statement to map them as follows:
MS Form priorities | Jira Priorities |
Critical | 1-Highest |
[There is no option in the form mapped to 2-High] | 2-High |
Required | 3-Medium |
Recommended | 4-Low |
Desirable | 5-Lowest |
The following expression throws up an error (see below).
if(equals(outputs('Get_response_details')?['r6feb3f1162691m20a35010203cprp6b0'],'Critical'),'1-Highest', '',
if(equals(outputs('Get_response_details')?['r6feb3f1162691m20a35010203cprp6b0'],'Required'),'3-Medium', '',
if(equals(outputs('Get_response_details')?['r6feb3f1162691m20a35010203cprp6b0'],'Recommended'),'4-Low', '',
if(equals(outputs('Get_response_details')?['r6feb3f1162691m20a35010203cprp6b0'],'Desirable'),'5-Lowest', ''))))
InvalidTemplate. Unable to process template language expressions in action 'Create_a_new_issue' inputs at line '0' and column '0': 'The template language function 'if' expects three parameter: the condition to test as the first parameter, the value to return if the condition is true as the second parameter, and the value to return if the condition is false as the third parameter. The function was invoked with '4' parameter(s). Please see https://aka.ms/logicexpressions#if for usage details.'.
I had previously tried it without the empty single quotations at the end of each line, but the error message said I had only invoked 2 parameters. Any ideas on how I can make this work please?
Many thanks
Seems to be successive if conditions. Please try this formula:
if(equals(outputs('Get_response_details')?['r6feb3f1162691m20a35010203cprp6b0'],'Critical'),
'1-Highest',
if(equals(outputs('Get_response_details')?['r6feb3f1162691m20a35010203cprp6b0'],'Required'),
'3-Medium',
if(equals(outputs('Get_response_details')?['r6feb3f1162691m20a35010203cprp6b0'],'Recommended'),
'4-Low',
if(equals(outputs('Get_response_details')?['r6feb3f1162691m20a35010203cprp6b0'],'Desirable'),
'5-Lowest',
''
)
)
)
)
Hope it helps !
Another option is to compose an object with your mappings, then pass your field in to get the relevant Jira value.
Mappings.
{
"Critical": "1-Highest",
"Required": "3-Medium",
"Recommended": "4-Low",
"Desirable": "5-Lowest"
}
Then to get the value for Required (as an example).
outputs('Priority')?['Required']
For your example, you would pass in the field from your Form.
outputs('Priority')?[outputs('Get_response_details')?['r6feb3f1162691m20a35010203cprp6b0']]
@gabibalaban, thanks so much for your advice! Whilst that fixed the initial issue, it's unfortunately thrown up a new error message:
{
"errorMessages": [],
"errors": {
"summary": "Operation value must be a string"
}
}
I've had a dig around to see if I can work out what I need to do now, but I'm not sure - any ideas please?
Thanks again
Hi @grantjenkins, thanks for your reply as well (sorry, didn't see it when I replied earlier!)
I'll give this a go as well - where would be best to put this in the flow? Before the 'get response details', or 'create a new issue' sections?
You would create the Priority (Compose) mapping directly after your trigger (before the Apply to each). Then you can get the mapped value from anywhere in your flow.
User | Count |
---|---|
24 | |
15 | |
14 | |
10 | |
9 |
User | Count |
---|---|
48 | |
29 | |
28 | |
25 | |
23 |