cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Chandu
Level: Powered On

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
Super User
Super User

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

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!



View solution in original post

12 REPLIES 12
Krishna92
Level 8

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

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

Chandu
Level: Powered On

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

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.
Chandu
Level: Powered On

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

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.

Super User
Super User

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

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!



View solution in original post

Chandu
Level: Powered On

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

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.

Super User
Super User

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

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!



Chandu
Level: Powered On

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

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

Super User
Super User

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

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!



Chandu
Level: Powered On

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

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

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

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!



Chandu
Level: Powered On

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

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

Capture.PNG

 

Super User
Super User

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

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!



Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (5,674)