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

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
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!

Learn more from my blog

View solution in original post

12 REPLIES 12
Highlighted
Microsoft
Microsoft

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.

Highlighted
Helper II
Helper II

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.
Highlighted
Helper II
Helper II

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.

Highlighted
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!

Learn more from my blog

View solution in original post

Highlighted
Helper II
Helper II

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.

Highlighted
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!

Learn more from my blog
Highlighted
Helper II
Helper II

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.

Highlighted
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!

Learn more from my blog
Highlighted
Helper II
Helper II

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
Highlighted
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!

Learn more from my blog
Highlighted
Helper II
Helper II

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

 

Highlighted
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!

Learn more from my blog

Helpful resources

Announcements
firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

Top Solution Authors
Users online (10,010)