cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
KateyPavely
New Member

Looking for help with an if formula to convert values from an MS form response to priorities I can map to Jira

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 prioritiesJira Priorities
Critical1-Highest
[There is no option in the form mapped to 2-High]2-High
Required3-Medium
Recommended4-Low
Desirable5-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

5 REPLIES 5
gabibalaban
Dual Super User
Dual Super User

@KateyPavely ,

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 !

 

grantjenkins
Community Champion
Community Champion

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']

grantjenkins_0-1669555224777.png

 

For your example, you would pass in the field from your Form.

outputs('Priority')?[outputs('Get_response_details')?['r6feb3f1162691m20a35010203cprp6b0']]

 



----------------------------------------------------------------------

If I've answered your question, please mark the post as Solved.

If you like my response, please consider giving it a Thumbs Up.

@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?

 

KateyPavely_0-1669560037643.png

 

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.



----------------------------------------------------------------------

If I've answered your question, please mark the post as Solved.

If you like my response, please consider giving it a Thumbs Up.

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (3,131)