Hi,
Can anyone please help with this:
In my flow, i get the body text of an email from the bottom line and set VariableA. This VariableA could be either 1,2,3 or 4
I then want to set another variable called VariableB with a corresponding entry such as 1= dog, 2=cat, 3=rabbit, 4=parrot
I guess i need a Set Variable, but can anyone help with the expression? I assume if statement but not sure
thanks
Hi @Sharpharp ,
I did another test for your reference.
In my scenario:
My Flow Parameters Configuration:
trim(split(split(outputs('Get_message_details')?['body/body/plainTextContent'],'Choice ID:')[1],decodeUriComponent('%0A'))[0])
if(equals(outputs('Compose'),'1'),'dog',
if(equals(outputs('Compose'),'2'),'cat',
if(equals(outputs('Compose'),'3'),'rabbit',
'parrot')))
Teams Channel Message:
If you still have trouble extracting your Choice ID, can you please post a screenshot of your Teams message?
I want to know the text structure inside so that I can better help you solve the problem.
Best Regards,
Sunshine Gu
It helped, but didn't quite solve the issue. the html to text and trim commands were giving errors my side.
I tackled it dfifferently using - trim(substring(outputs('Get_message_details')?['body/body/plainTextContent'] inside a for each message loop. The if statement was a big help, so thanks
Hi @Sharpharp ,
If I solve your problem, please mark my response as a solution so you and I can help more people who are experiencing this challenge in the future.
Best Regards,
Sunshine Gu
thank you
Hi @Sharpharp ,
Please check this test:
My Email:
My Flow Overall Preview:
My Flow Configuration Parameters:
trim(split(split(outputs('Html_to_text')?['body'],'Choice ID:')[1],decodeUriComponent('%0A'))[0])
if(equals(variables('A'),'1'),'dog',
if(equals(variables('A'),'2'),'cat',
if(equals(variables('A'),'3'),'rabbit',
'parrot')))
Best Regards,
Sunshine Gu
thanks for the quick reply. It seems my initial flow isn't working.
I want to get Variable A from the body of the email: I added the last line in the email which starts Choice ID: -then followed by 1,2,3 or 4
Could you please help on how i get that 1,2,3 or 4 from the body of the email into Variable A.
Can we read that last line in the email to grab what the CHOIC ID number is and chuck it into Variable A?
Your if statement is perfect, happy with that bit so thanks.
Hi @Sharpharp ,
Please check this test:
if(equals(variables('A'),'1'),'dog',
if(equals(variables('A'),'2'),'cat',
if(equals(variables('A'),'3'),'rabbit',
'parrot')))
Best Regards,
Sunshine Gu
Michael E. Gernaey
566
Super User 2025 Season 1
David_MA
516
Super User 2025 Season 1
stampcoin
492