cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper III
Helper III

How to get some of answer which is in Json format in body of the Mail

I am sending an email notification(Send an Email(V2)) when someone responds to a custom action in kaizala.

I am having a Form in Kaizala, Where Question 1 : Contact Number and Answer 1 : {"cc":91,"pn":"1234567890"}

Now, In the Body of the Mail I am getting Question 1 : Answer 1 like:

Email Body.PNG

 

When Email Notification is sent, then the above Question 1 : Answer 1 input will be:

Contact Number : {"cc":91,"pn":"1234567890"}

But, I don't want Country Code (CC) in Email. How should I get only Phone Number(pn) from Answer Value in Body of the Mail.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Hi @Chandu 

 

Try the below steps

 

k9.png

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials

View solution in original post

12 REPLIES 12
Highlighted
Microsoft
Microsoft

@Chandu 

 

You can use the split function to extract only the phone number from the answer.

{"cc":91,"pn":"1234567890"}

 

The format of the split function in flow is split(text, separator string)

In the above case as you a , in between the two values you can use , as the separator string included in single quotes ','

Once you split the value will be divided in two the first part will have CC and second part will have PN

Now to take out only PN you can use last(outputs of split action) to take out only PN.

 

So on a overview you will need two compose actions one to split the data and one to extract only PN from the output.

Once you have the extracted value you can use the same in the email action.

 

If this information helps you, please hit the like button and mark the solution as resolved, so that it will help other users in future.

Highlighted

I wrote the Formula like: last(split('Answer 5', 'pn'))
split().PNG
 
 
 
 
 
 
 
In the body of the Mail, I got like:
Mail.PNG
Can you help me with this Formula.
Highlighted

In Answer 5(Dynamic Content): {"cc":91,"pn":"1234567890"}

I wrote the formula like: Last(Split('Answer 5', 'pn')). But result is not coming as Expected. I am getting Answer 5 as output of this formula instead of Mobile Number.

Can you help me with this formula as how to split Dynamic Content.

Highlighted
Super User III
Super User III

Hi @Chandu 

 

Try the below steps

 

k9.png

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials

View solution in original post

Highlighted

This solution is working fine. But it is bit lengthy. Is there any way like: Last(Split('Answer 5', 'pn')) in Expression Tab. So, that it will be easy.

Highlighted
Super User III
Super User III

Hi @Chandu 

 

Here it is

I have defined a variable called 'ContactNumber' and the value is {"cc":91,"pn":"1234567890"}

 

Below is the expression

 

replace(replace(last(split(variables('ContactNumber'),':')),'"',''),'}','')
 
Thanks
 


Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials
Highlighted

I am getting the Error as: The Expression is Invalid.

Highlighted
Super User III
Super User III

Hi @Chandu 

 

Could you please post a screenshot of your flow?

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials
Highlighted

The Formula I wrote(In the Body of the Mail) was: replace(replace(last(split(variables('Answer 5'),':')),'"',''),'}','')
Snip.PNG
Highlighted
Super User III
Super User III

Hi @Chandu 

 

Looks like you have got a space here in your variable name

 

variables('Answer 5')

 

Try

 

variables('Answer_5')

 

Thanks

 

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials
Highlighted

I removed the space and kept Answer_5. There is no error with the expression. But I am getting error like:

Capture.PNG

 

Highlighted
Super User III
Super User III

Hi @Chandu 

 

Could you post your PowerAutomate screenshot?



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Top Solution Authors
Top Kudoed Authors
Users online (8,764)