web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Unable to set variable...
Power Automate
Unanswered

Unable to set variable within Flow

(0) ShareShare
ReportReport
Posted on by 4

Hey guys,

Having a bit of trouble setting a variable. Getting the following error:
Unable to process template language expressions in action 'Variable_to_store_title_value' inputs at line '1' and column '50651': '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 '2' parameter(s). Please see https://aka.ms/logicexpressions#if for usage details.'.

Variable and logic I use, note newWorkRequestNumber resolves to 0001 for all cases:

Name: titleValue
Type: String
Value:
@{if(equals(outputs('Get_response_details')?['body/rA'], 'Change Request'), concat('CR-', variables('newWorkRequestNumber'), ' ', outputs('Get_response_details')?['body/rX']),
if(equals(outputs('Get_response_details')?['body/rA'], 'Incident'), concat('INC-', variables('newWorkRequestNumber'), ' ' , outputs('Get_response_details')?['body/rX']),
if(equals(outputs('Get_response_details')?['body/rA'], 'Task'), concat('TSK-', variables('newWorkRequestNumber'), ' ' , outputs('Get_response_details')?['body/rX'])
))}

So I should always get either 'Change Request', 'Incident' or 'Task' for the conditional logic; which will created a new variable as CR-0001 TitleName. My logic seems to be working for Change Request and Incidents, but getting the above error for Tasks.

Any help would be appreciated.

Categories:
I have the same question (0)
  • JeffGimo Profile Picture
    221 on at

    Can you also post a screenshot of your issue?

  • gav24 Profile Picture
    4 on at

    Hey Jeff, sure.

    gav24_0-1628842305391.png

     

    With the logic within the failed step (expression is above):

    gav24_1-1628842442739.png


    As mentioned, 'Change Request' and 'Incident' are working fine, but not 'Task'.

  • JeffGimo Profile Picture
    221 on at

    Can you try this expression instead.

    @{if(equals(outputs('Get_response_details')?['body/rA'], 'Change Request'), concat('CR-', variables('newWorkRequestNumber'), ' ', outputs('Get_response_details')?['body/rX']),
    if(equals(outputs('Get_response_details')?['body/rA'], 'Incident'), concat('INC-', variables('newWorkRequestNumber'), ' ' , outputs('Get_response_details')?['body/rX']),
    if(equals(outputs('Get_response_details')?['body/rA'], 'Task'), concat('TSK-', variables('newWorkRequestNumber'), ' ' , outputs('Get_response_details')?['body/rX'])
    )))}
  • gav24 Profile Picture
    4 on at

    Hey,

     

    Tried the above but same error occurred.

    Kind regards.

  • JeffGimo Profile Picture
    221 on at

    Try this one. 

    @{if(equals(outputs('Get_response_details')?['body/rA'], 'Change Request'), concat('CR-', variables('newWorkRequestNumber'), ' ', outputs('Get_response_details')?['body/rX'])),
    if(equals(outputs('Get_response_details')?['body/rA'], 'Incident'), concat('INC-', variables('newWorkRequestNumber'), ' ' , outputs('Get_response_details')?['body/rX']),
    if(equals(outputs('Get_response_details')?['body/rA'], 'Task'), concat('TSK-', variables('newWorkRequestNumber'), ' ' , outputs('Get_response_details')?['body/rX'])
    ))}

     

     

    If that doesn't work. Try to put each expression in an Compose and test it. You'll see what's wrong.

    if(equals(outputs('Get_response_details')?['body/rA'], 'Task'), concat('TSK-', variables('newWorkRequestNumber'), ' ' , outputs('Get_response_details')?['body/rX']))
    
    
    if(equals(outputs('Get_response_details')?['body/rA'], 'Incident'), concat('INC-', variables('newWorkRequestNumber'), ' ' , outputs('Get_response_details')?['body/rX']))
    
    
    if(equals(outputs('Get_response_details')?['body/rA'], 'Change Request'), concat('CR-', variables('newWorkRequestNumber'), ' ', outputs('Get_response_details')?['body/rX']))

     

  • JeffGimo Profile Picture
    221 on at

    I think you're missing another expression and a closing parenthesis.

    Try this expression instead.

    @{if(equals(outputs('Get_response_details')?['body/rA'], 'Change Request'), concat('CR-', variables('newWorkRequestNumber'), ' ', outputs('Get_response_details')?['body/rX']),
    if(equals(outputs('Get_response_details')?['body/rA'], 'Incident'), concat('INC-', variables('newWorkRequestNumber'), ' ' , outputs('Get_response_details')?['body/rX']),
    if(equals(outputs('Get_response_details')?['body/rA'], 'Task'), concat('TSK-', variables('newWorkRequestNumber'), ' ' , outputs('Get_response_details')?['body/rX']), 'Missing Expression')))}

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 801

#2
Valantis Profile Picture

Valantis 602

#3
Haque Profile Picture

Haque 581

Last 30 days Overall leaderboard