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.
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')))}
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']))
Hey,
Tried the above but same error occurred.
Kind regards.
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'])
)))}
Hey Jeff, sure.
With the logic within the failed step (expression is above):
As mentioned, 'Change Request' and 'Incident' are working fine, but not 'Task'.
Can you also post a screenshot of your issue?
Tomac
986
Moderator
stampcoin
699
Super User 2025 Season 2
Riyaz_riz11
577
Super User 2025 Season 2